Skip to content

Commit 4d76ddf

Browse files
authored
Update test framework (#127)
1 parent 78e7211 commit 4d76ddf

13 files changed

+74
-68
lines changed

Tests/NFUnitTestAdpater/NFUnitTestAdapater.nfproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
<Private>True</Private>
3737
<SpecificVersion>True</SpecificVersion>
3838
</Reference>
39-
<Reference Include="nanoFramework.TestFramework, Version=1.0.80.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
40-
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.80\lib\nanoFramework.TestFramework.dll</HintPath>
39+
<Reference Include="nanoFramework.TestFramework, Version=1.0.92.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
40+
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.92\lib\nanoFramework.TestFramework.dll</HintPath>
4141
<Private>True</Private>
4242
<SpecificVersion>True</SpecificVersion>
4343
</Reference>
4444
<Reference Include="nanoFramework.UnitTestLauncher, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
45-
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.80\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
45+
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.92\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
4646
<Private>True</Private>
4747
<SpecificVersion>True</SpecificVersion>
4848
</Reference>
@@ -52,9 +52,17 @@
5252
<None Include="packages.config" />
5353
</ItemGroup>
5454
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
55+
<!-- MANUAL UPDATE HERE -->
56+
<Import Project="..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets" Condition="Exists('..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets')" />
5557
<ProjectExtensions>
5658
<ProjectCapabilities>
5759
<ProjectConfigurationsDeclaredAsItems />
5860
</ProjectCapabilities>
5961
</ProjectExtensions>
62+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
63+
<PropertyGroup>
64+
<WarningText>Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder.</WarningText>
65+
</PropertyGroup>
66+
<Warning Condition="!Exists('..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets')" Text="'$(WarningText)'" />
67+
</Target>
6068
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="nanoFramework.CoreLibrary" version="1.10.1-preview.11" targetFramework="netnanoframework10" />
4-
<package id="nanoFramework.TestFramework" version="1.0.80" targetFramework="netnanoframework10" developmentDependency="true" />
4+
<package id="nanoFramework.TestFramework" version="1.0.92" targetFramework="netnanoframework10" developmentDependency="true" />
55
</packages>

Tests/NFUnitTestConversions/UnitTestConvertTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,16 @@ public void Convert_Negative()
104104

105105
SByte value_sb = Convert.ToSByte(number);
106106
Assert.Equal(value_sb, (sbyte)actualNumber);
107-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { Byte value_b = Convert.ToByte(number); });
107+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { Byte value_b = Convert.ToByte(number); });
108108
Int16 value_s16 = Convert.ToInt16(number);
109109
Assert.Equal(value_s16, (short)actualNumber);
110-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt16 value_u16 = Convert.ToUInt16(number); });
110+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt16 value_u16 = Convert.ToUInt16(number); });
111111
Int32 value_s32 = Convert.ToInt32(number);
112112
Assert.Equal(value_s32, (int)actualNumber);
113-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt32 value_u32 = Convert.ToUInt32(number); });
113+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt32 value_u32 = Convert.ToUInt32(number); });
114114
Int64 value_s64 = Convert.ToInt32(number);
115115
Assert.Equal(value_s64, (long)actualNumber);
116-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt64 value_u64 = Convert.ToUInt64(number); });
116+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt64 value_u64 = Convert.ToUInt64(number); });
117117
}
118118

119119
[TestMethod]

Tests/NFUnitTestSystemLib/UnitTestDateTime.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,16 +1028,16 @@ public void DateTime_BelowMinDateTime_ArgumentOutOfRangeExceptionTest58()
10281028
{
10291029
Debug.WriteLine("Creating a DateTime with -ve Ticks and,");
10301030
Debug.WriteLine("verifying ArgumentOutOfRangeException is thrown");
1031-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt = new DateTime(-(new Random().Next(10) + 1)); });
1031+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { DateTime dt = new DateTime(-(new Random().Next(10) + 1)); });
10321032
}
10331033

10341034
[TestMethod]
10351035
public void DateTime_AboveMaxDatTime_ArgumentOutOfRangeExceptionTest59()
10361036
{
10371037
Debug.WriteLine("Creating a DateTime later than DateTime.MaxValue and,");
10381038
Debug.WriteLine("verifying ArgumentOutOfRangeException is thrown");
1039-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt1 = new DateTime(DateTime.MaxValue.Ticks + 1); });
1040-
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt2 = new DateTime(10000, 1, 1, 0, 0, 0, 0); });
1039+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { DateTime dt1 = new DateTime(DateTime.MaxValue.Ticks + 1); });
1040+
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { DateTime dt2 = new DateTime(10000, 1, 1, 0, 0, 0, 0); });
10411041
}
10421042

10431043
static double[] rdmFraction = new double[] { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 };

Tests/NFUnitTestSystemLib/UnitTestGuid.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void ArgumentException_Test3()
8888
size = random.Next(100);
8989
}
9090
Byte[] guidNot16 = GetRandomBytes(size);
91-
Assert.Trows(typeof(ArgumentException), () => { Guid myGuid1 = new Guid(guidNot16); });
91+
Assert.Throws(typeof(ArgumentException), () => { Guid myGuid1 = new Guid(guidNot16); });
9292
}
9393

9494
[TestMethod]
@@ -101,7 +101,7 @@ public void ArgumentNullException_Test4()
101101
///
102102

103103
Byte[] nullByte = null;
104-
Assert.Trows(typeof(ArgumentNullException), () => { Guid myGuid1 = new Guid(nullByte); });
104+
Assert.Throws(typeof(ArgumentNullException), () => { Guid myGuid1 = new Guid(nullByte); });
105105
}
106106

107107
public static Guid GetGuid()

Tests/NFUnitTestSystemLib/UnitTestParseTests.cs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -491,49 +491,49 @@ public void UInt64_Boundary_Test_16()
491491
[TestMethod]
492492
public void SByte_ArgumentNullException_Test_17()
493493
{
494-
Assert.Trows(typeof(ArgumentNullException), () => { SByte.Parse(str); });
494+
Assert.Throws(typeof(ArgumentNullException), () => { SByte.Parse(str); });
495495
}
496496

497497
[TestMethod]
498498
public void Byte_ArgumentNullException_Test_18()
499499
{
500-
Assert.Trows(typeof(ArgumentNullException), () => { Byte.Parse(str); });
500+
Assert.Throws(typeof(ArgumentNullException), () => { Byte.Parse(str); });
501501
}
502502

503503
[TestMethod]
504504
public void Int16_ArgumentNullException_Test_19()
505505
{
506-
Assert.Trows(typeof(ArgumentNullException), () => { Int16.Parse(str); });
506+
Assert.Throws(typeof(ArgumentNullException), () => { Int16.Parse(str); });
507507
}
508508

509509
[TestMethod]
510510
public void UInt16_ArgumentNullException_Test_20()
511511
{
512-
Assert.Trows(typeof(ArgumentNullException), () => { UInt16.Parse(str); });
512+
Assert.Throws(typeof(ArgumentNullException), () => { UInt16.Parse(str); });
513513
}
514514

515515
[TestMethod]
516516
public void Int32_ArgumentNullException_Test_21()
517517
{
518-
Assert.Trows(typeof(ArgumentNullException), () => { Int32.Parse(str); });
518+
Assert.Throws(typeof(ArgumentNullException), () => { Int32.Parse(str); });
519519
}
520520

521521
[TestMethod]
522522
public void UInt32_ArgumentNullException_Test_22()
523523
{
524-
Assert.Trows(typeof(ArgumentNullException), () => { UInt32.Parse(str); });
524+
Assert.Throws(typeof(ArgumentNullException), () => { UInt32.Parse(str); });
525525
}
526526

527527
[TestMethod]
528528
public void Int64_ArgumentNullException_Test_23()
529529
{
530-
Assert.Trows(typeof(ArgumentNullException), () => { Int64.Parse(str); });
530+
Assert.Throws(typeof(ArgumentNullException), () => { Int64.Parse(str); });
531531
}
532532

533533
[TestMethod]
534534
public void UInt64_ArgumentNullException_Test_24()
535535
{
536-
Assert.Trows(typeof(ArgumentNullException), () => { UInt64.Parse(str); });
536+
Assert.Throws(typeof(ArgumentNullException), () => { UInt64.Parse(str); });
537537
}
538538

539539
/// <summary>
@@ -581,12 +581,12 @@ public void ParseSByte_FormatException_Test_25()
581581
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
582582
for (int i = 0; i < strArr.Length; i++)
583583
{
584-
Assert.Trows(typeof(Exception), () => { SByte.Parse(strArr[i]); });
584+
Assert.Throws(typeof(Exception), () => { SByte.Parse(strArr[i]); });
585585
}
586586
for (int i = 0; i < 5; i++)
587587
{
588588
String rdmString = GetRandomString();
589-
Assert.Trows(typeof(Exception), () => { SByte.Parse(rdmString); });
589+
Assert.Throws(typeof(Exception), () => { SByte.Parse(rdmString); });
590590
}
591591
}
592592

@@ -596,12 +596,12 @@ public void ParseByte_FormatException_Test_26()
596596
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
597597
for (int i = 0; i < strArr.Length; i++)
598598
{
599-
Assert.Trows(typeof(Exception), () => { Byte.Parse(strArr[i]); });
599+
Assert.Throws(typeof(Exception), () => { Byte.Parse(strArr[i]); });
600600
}
601601
for (int i = 0; i < 5; i++)
602602
{
603603
String rdmString = GetRandomString();
604-
Assert.Trows(typeof(Exception), () => { Byte.Parse(rdmString); });
604+
Assert.Throws(typeof(Exception), () => { Byte.Parse(rdmString); });
605605
}
606606
}
607607

@@ -611,12 +611,12 @@ public void ParseInt16_FormatException_Test_27()
611611
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
612612
for (int i = 0; i < strArr.Length; i++)
613613
{
614-
Assert.Trows(typeof(Exception), () => { Int16.Parse(strArr[i]); });
614+
Assert.Throws(typeof(Exception), () => { Int16.Parse(strArr[i]); });
615615
}
616616
for (int i = 0; i < 5; i++)
617617
{
618618
String rdmString = GetRandomString();
619-
Assert.Trows(typeof(Exception), () => { Int16.Parse(rdmString); });
619+
Assert.Throws(typeof(Exception), () => { Int16.Parse(rdmString); });
620620
}
621621
}
622622

@@ -626,12 +626,12 @@ public void ParseUInt16_FormatException_Test_28()
626626
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
627627
for (int i = 0; i < strArr.Length; i++)
628628
{
629-
Assert.Trows(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
629+
Assert.Throws(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
630630
}
631631
for (int i = 0; i < 5; i++)
632632
{
633633
String rdmString = GetRandomString();
634-
Assert.Trows(typeof(Exception), () => { UInt16.Parse(rdmString); });
634+
Assert.Throws(typeof(Exception), () => { UInt16.Parse(rdmString); });
635635
}
636636
}
637637

@@ -641,12 +641,12 @@ public void ParseInt32_FormatException_Test_29()
641641
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
642642
for (int i = 0; i < strArr.Length; i++)
643643
{
644-
Assert.Trows(typeof(Exception), () => { Int32.Parse(strArr[i]); });
644+
Assert.Throws(typeof(Exception), () => { Int32.Parse(strArr[i]); });
645645
}
646646
for (int i = 0; i < 5; i++)
647647
{
648648
String rdmString = GetRandomString();
649-
Assert.Trows(typeof(Exception), () => { Int32.Parse(rdmString); });
649+
Assert.Throws(typeof(Exception), () => { Int32.Parse(rdmString); });
650650
}
651651
}
652652

@@ -656,12 +656,12 @@ public void ParseUInt32_FormatException_Test_30()
656656
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
657657
for (int i = 0; i < strArr.Length; i++)
658658
{
659-
Assert.Trows(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
659+
Assert.Throws(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
660660
}
661661
for (int i = 0; i < 5; i++)
662662
{
663663
String rdmString = GetRandomString();
664-
Assert.Trows(typeof(Exception), () => { UInt32.Parse(rdmString); });
664+
Assert.Throws(typeof(Exception), () => { UInt32.Parse(rdmString); });
665665
}
666666
}
667667

@@ -671,12 +671,12 @@ public void ParseInt64_FormatException_Test_31()
671671
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
672672
for (int i = 0; i < strArr.Length; i++)
673673
{
674-
Assert.Trows(typeof(Exception), () => { Int64.Parse(strArr[i]); });
674+
Assert.Throws(typeof(Exception), () => { Int64.Parse(strArr[i]); });
675675
}
676676
for (int i = 0; i < 5; i++)
677677
{
678678
String rdmString = GetRandomString();
679-
Assert.Trows(typeof(Exception), () => { Int64.Parse(rdmString); });
679+
Assert.Throws(typeof(Exception), () => { Int64.Parse(rdmString); });
680680
}
681681
}
682682

@@ -686,12 +686,12 @@ public void ParseUInt64_FormatException_Test_32()
686686
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
687687
for (int i = 0; i < strArr.Length; i++)
688688
{
689-
Assert.Trows(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
689+
Assert.Throws(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
690690
}
691691
for (int i = 0; i < 5; i++)
692692
{
693693
String rdmString = GetRandomString();
694-
Assert.Trows(typeof(Exception), () => { UInt64.Parse(rdmString); });
694+
Assert.Throws(typeof(Exception), () => { UInt64.Parse(rdmString); });
695695
}
696696
}
697697

@@ -707,7 +707,7 @@ public void ParseSByte_OverflowException_Test_33()
707707
((Int64)SByte.MaxValue + 1).ToString(), ((Int64)SByte.MaxValue + 100).ToString() };
708708
for (int i = 0; i < strArr.Length; i++)
709709
{
710-
Assert.Trows(typeof(Exception), () => { SByte.Parse(strArr[i]); });
710+
Assert.Throws(typeof(Exception), () => { SByte.Parse(strArr[i]); });
711711
}
712712
}
713713

@@ -718,7 +718,7 @@ public void ParseByte_OverflowException_Test_34()
718718
((Int64)Byte.MaxValue + 1).ToString(), ((Int64)Byte.MaxValue + 100).ToString() };
719719
for (int i = 0; i < strArr.Length; i++)
720720
{
721-
Assert.Trows(typeof(Exception), () => { Byte.Parse(strArr[i]); });
721+
Assert.Throws(typeof(Exception), () => { Byte.Parse(strArr[i]); });
722722
}
723723
}
724724

@@ -729,7 +729,7 @@ public void ParseInt16_OverflowException_Test_35()
729729
((Int64)Int16.MaxValue + 1).ToString(), ((Int64)Int16.MaxValue + 100).ToString() };
730730
for (int i = 0; i < strArr.Length; i++)
731731
{
732-
Assert.Trows(typeof(Exception), () => { Int16.Parse(strArr[i]); });
732+
Assert.Throws(typeof(Exception), () => { Int16.Parse(strArr[i]); });
733733
}
734734
}
735735

@@ -740,7 +740,7 @@ public void ParseUInt16_OverflowException_Test_36()
740740
((Int64)UInt16.MaxValue + 1).ToString(), ((Int64)UInt16.MaxValue + 100).ToString() };
741741
for (int i = 0; i < strArr.Length; i++)
742742
{
743-
Assert.Trows(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
743+
Assert.Throws(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
744744
}
745745
}
746746

@@ -751,7 +751,7 @@ public void ParseInt32_OverflowException_Test_37()
751751
((Int64)Int32.MaxValue + 1).ToString(), ((Int64)Int32.MaxValue + 100).ToString() };
752752
for (int i = 0; i < strArr.Length; i++)
753753
{
754-
Assert.Trows(typeof(Exception), () => { Int32.Parse(strArr[i]); });
754+
Assert.Throws(typeof(Exception), () => { Int32.Parse(strArr[i]); });
755755
}
756756
}
757757

@@ -762,7 +762,7 @@ public void ParseUInt32_OverflowException_Test_38()
762762
((Int64)UInt32.MaxValue + 1).ToString(), ((Int64)UInt32.MaxValue + 100).ToString() };
763763
for (int i = 0; i < strArr.Length; i++)
764764
{
765-
Assert.Trows(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
765+
Assert.Throws(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
766766
}
767767
}
768768

@@ -774,7 +774,7 @@ public void ParseInt64_OverflowException_Test_39()
774774
"9223372036854775808", "9223372036854775900" };
775775
for (int i = 0; i < strArr.Length; i++)
776776
{
777-
Assert.Trows(typeof(Exception), () => { Int64.Parse(strArr[i]); });
777+
Assert.Throws(typeof(Exception), () => { Int64.Parse(strArr[i]); });
778778
}
779779
}
780780

@@ -784,7 +784,7 @@ public void ParseUInt64_OverflowException_Test_40()
784784
string[] strArr = new string[] { "-1", "-100", "18446744073709551616", "18446744073709551700" };
785785
for (int i = 0; i < strArr.Length; i++)
786786
{
787-
Assert.Trows(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
787+
Assert.Throws(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
788788
}
789789
}
790790

@@ -850,27 +850,27 @@ public void box_unbox_Test_1()
850850
Guid guid = (Guid)o_guid;
851851

852852
// Now casts that should throw exception. Any cast that does not throw - means error.
853-
Assert.Trows(typeof(InvalidCastException), () => {
853+
Assert.Throws(typeof(InvalidCastException), () => {
854854
MyEnum1 e1 = (MyEnum1)o_enum;
855855
});
856856

857857
// Now casts that should throw exception. Any cast that does not throw - means error.
858-
Assert.Trows(typeof(InvalidCastException), () => {
858+
Assert.Throws(typeof(InvalidCastException), () => {
859859
int i = (int)o_long;
860860
});
861861

862862
// Now casts that should throw exception. Any cast that does not throw - means error.
863-
Assert.Trows(typeof(InvalidCastException), () => {
863+
Assert.Throws(typeof(InvalidCastException), () => {
864864
int i = (int)o_class;
865865
});
866866

867867
// Now casts that should throw exception. Any cast that does not throw - means error.
868-
Assert.Trows(typeof(InvalidCastException), () => {
868+
Assert.Throws(typeof(InvalidCastException), () => {
869869
int i = (int)o_enum;
870870
});
871871

872872
// Now casts that should throw exception. Any cast that does not throw - means error.
873-
Assert.Trows(typeof(InvalidCastException), () => {
873+
Assert.Throws(typeof(InvalidCastException), () => {
874874
int i = (int)o_guid;
875875
});
876876
}

0 commit comments

Comments
 (0)