-
-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathNativeAOTOutOfProcess.cs
More file actions
65 lines (52 loc) · 2.54 KB
/
NativeAOTOutOfProcess.cs
File metadata and controls
65 lines (52 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using ExcelDna.Testing;
using Microsoft.Office.Interop.Excel;
using Range = Microsoft.Office.Interop.Excel.Range;
namespace ExcelDna.RuntimeTests
{
[ExcelTestSettings(OutOfProcess = true)]
[Collection("OutOfProcess")]
public class NativeAOTOutOfProcess
{
[ExcelFact(Workbook = "", AddIn = AddInPath.RuntimeTestsAOT)]
public void AsyncTask()
{
Runner.ExecuteWithRetryWhenExcelBusy(() =>
{
Range functionRange = ((Worksheet)ExcelDna.Testing.Util.Workbook.Sheets[1]).Range["B1"];
functionRange.Formula = "=NativeAsyncTaskHello(\"world\", 200)";
Automation.WaitFor(() => functionRange.Value?.ToString() == "Hello native async task world", 1000);
Assert.Equal("Hello native async task world", functionRange.Value.ToString());
});
}
[ExcelFact(Workbook = "", AddIn = AddInPath.RuntimeTestsAOT)]
public void AsyncSleep()
{
Runner.ExecuteWithRetryWhenExcelBusy(() =>
{
Range functionRange = ((Worksheet)ExcelDna.Testing.Util.Workbook.Sheets[1]).Range["B1"];
functionRange.Formula = "=NativeAsyncHello(\"world\", 0)";
Automation.WaitFor(() => functionRange.Value?.ToString() == "Hello native async world", 1000);
Assert.Equal("Hello native async world", functionRange.Value.ToString());
});
Runner.ExecuteWithRetryWhenExcelBusy(() =>
{
Range functionRange = ((Worksheet)ExcelDna.Testing.Util.Workbook.Sheets[1]).Range["C1"];
functionRange.Formula = "=NativeAsyncHello(\"world\", 200)";
Automation.WaitFor(() => functionRange.Value?.ToString() == "Hello native async world", 2000);
Assert.Equal("Hello native async world", functionRange.Value.ToString());
});
}
[ExcelFact(Workbook = "", AddIn = AddInPath.RuntimeTestsAOT)]
public void DynamicApplication()
{
Runner.ExecuteWithRetryWhenExcelBusy(() =>
{
Range functionRange1 = ((Worksheet)ExcelDna.Testing.Util.Workbook.Sheets[1]).Range["E1"];
Range functionRange2 = ((Worksheet)ExcelDna.Testing.Util.Workbook.Sheets[1]).Range["E2"];
functionRange2.Formula = "=NativeApplicationAlignCellRight(\"E1\")";
Assert.Equal(-4152, functionRange2.Value);
Assert.Equal(-4152, (int)functionRange1.HorizontalAlignment);
});
}
}
}