Skip to content

Commit

Permalink
Update test framework
Browse files Browse the repository at this point in the history
- Update NuGet.
- Brought test adapter clone up to speed with test project.
- Update test framework submodel @56156e4.
  • Loading branch information
josesimoes committed Mar 21, 2021
1 parent 78e7211 commit 12b88f1
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 67 deletions.
14 changes: 11 additions & 3 deletions Tests/NFUnitTestAdpater/NFUnitTestAdapater.nfproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="nanoFramework.TestFramework, Version=1.0.80.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.80\lib\nanoFramework.TestFramework.dll</HintPath>
<Reference Include="nanoFramework.TestFramework, Version=1.0.92.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.92\lib\nanoFramework.TestFramework.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
<Reference Include="nanoFramework.UnitTestLauncher, Version=0.0.0.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.80\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
<HintPath>..\..\packages\nanoFramework.TestFramework.1.0.92\lib\nanoFramework.UnitTestLauncher.exe</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
Expand All @@ -52,9 +52,17 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
<!-- MANUAL UPDATE HERE -->
<Import Project="..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets" Condition="Exists('..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets')" />
<ProjectExtensions>
<ProjectCapabilities>
<ProjectConfigurationsDeclaredAsItems />
</ProjectCapabilities>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<WarningText>Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder.</WarningText>
</PropertyGroup>
<Warning Condition="!Exists('..\..\packages\nanoFramework.TestFramework.1.0.92\build\nanoFramework.TestFramework.targets')" Text="'$(WarningText)'" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion Tests/NFUnitTestAdpater/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nanoFramework.CoreLibrary" version="1.10.1-preview.11" targetFramework="netnanoframework10" />
<package id="nanoFramework.TestFramework" version="1.0.80" targetFramework="netnanoframework10" developmentDependency="true" />
<package id="nanoFramework.TestFramework" version="1.0.92" targetFramework="netnanoframework10" developmentDependency="true" />
</packages>
8 changes: 4 additions & 4 deletions Tests/NFUnitTestConversions/UnitTestConvertTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ public void Convert_Negative()

SByte value_sb = Convert.ToSByte(number);
Assert.Equal(value_sb, (sbyte)actualNumber);
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { Byte value_b = Convert.ToByte(number); });
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { Byte value_b = Convert.ToByte(number); });
Int16 value_s16 = Convert.ToInt16(number);
Assert.Equal(value_s16, (short)actualNumber);
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt16 value_u16 = Convert.ToUInt16(number); });
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt16 value_u16 = Convert.ToUInt16(number); });
Int32 value_s32 = Convert.ToInt32(number);
Assert.Equal(value_s32, (int)actualNumber);
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt32 value_u32 = Convert.ToUInt32(number); });
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt32 value_u32 = Convert.ToUInt32(number); });
Int64 value_s64 = Convert.ToInt32(number);
Assert.Equal(value_s64, (long)actualNumber);
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt64 value_u64 = Convert.ToUInt64(number); });
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { UInt64 value_u64 = Convert.ToUInt64(number); });
}

[TestMethod]
Expand Down
6 changes: 3 additions & 3 deletions Tests/NFUnitTestSystemLib/UnitTestDateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,16 +1028,16 @@ public void DateTime_BelowMinDateTime_ArgumentOutOfRangeExceptionTest58()
{
Debug.WriteLine("Creating a DateTime with -ve Ticks and,");
Debug.WriteLine("verifying ArgumentOutOfRangeException is thrown");
Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt = new DateTime(-(new Random().Next(10) + 1)); });
Assert.Throws(typeof(ArgumentOutOfRangeException), () => { DateTime dt = new DateTime(-(new Random().Next(10) + 1)); });
}

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

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 };
Expand Down
4 changes: 2 additions & 2 deletions Tests/NFUnitTestSystemLib/UnitTestGuid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void ArgumentException_Test3()
size = random.Next(100);
}
Byte[] guidNot16 = GetRandomBytes(size);
Assert.Trows(typeof(ArgumentException), () => { Guid myGuid1 = new Guid(guidNot16); });
Assert.Throws(typeof(ArgumentException), () => { Guid myGuid1 = new Guid(guidNot16); });
}

[TestMethod]
Expand All @@ -101,7 +101,7 @@ public void ArgumentNullException_Test4()
///

Byte[] nullByte = null;
Assert.Trows(typeof(ArgumentNullException), () => { Guid myGuid1 = new Guid(nullByte); });
Assert.Throws(typeof(ArgumentNullException), () => { Guid myGuid1 = new Guid(nullByte); });
}

public static Guid GetGuid()
Expand Down
74 changes: 37 additions & 37 deletions Tests/NFUnitTestSystemLib/UnitTestParseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,49 +491,49 @@ public void UInt64_Boundary_Test_16()
[TestMethod]
public void SByte_ArgumentNullException_Test_17()
{
Assert.Trows(typeof(ArgumentNullException), () => { SByte.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { SByte.Parse(str); });
}

[TestMethod]
public void Byte_ArgumentNullException_Test_18()
{
Assert.Trows(typeof(ArgumentNullException), () => { Byte.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { Byte.Parse(str); });
}

[TestMethod]
public void Int16_ArgumentNullException_Test_19()
{
Assert.Trows(typeof(ArgumentNullException), () => { Int16.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { Int16.Parse(str); });
}

[TestMethod]
public void UInt16_ArgumentNullException_Test_20()
{
Assert.Trows(typeof(ArgumentNullException), () => { UInt16.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { UInt16.Parse(str); });
}

[TestMethod]
public void Int32_ArgumentNullException_Test_21()
{
Assert.Trows(typeof(ArgumentNullException), () => { Int32.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { Int32.Parse(str); });
}

[TestMethod]
public void UInt32_ArgumentNullException_Test_22()
{
Assert.Trows(typeof(ArgumentNullException), () => { UInt32.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { UInt32.Parse(str); });
}

[TestMethod]
public void Int64_ArgumentNullException_Test_23()
{
Assert.Trows(typeof(ArgumentNullException), () => { Int64.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { Int64.Parse(str); });
}

[TestMethod]
public void UInt64_ArgumentNullException_Test_24()
{
Assert.Trows(typeof(ArgumentNullException), () => { UInt64.Parse(str); });
Assert.Throws(typeof(ArgumentNullException), () => { UInt64.Parse(str); });
}

/// <summary>
Expand Down Expand Up @@ -581,12 +581,12 @@ public void ParseSByte_FormatException_Test_25()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { SByte.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { SByte.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { SByte.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { SByte.Parse(rdmString); });
}
}

Expand All @@ -596,12 +596,12 @@ public void ParseByte_FormatException_Test_26()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { Byte.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { Byte.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { Byte.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { Byte.Parse(rdmString); });
}
}

Expand All @@ -611,12 +611,12 @@ public void ParseInt16_FormatException_Test_27()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { Int16.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { Int16.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { Int16.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { Int16.Parse(rdmString); });
}
}

Expand All @@ -626,12 +626,12 @@ public void ParseUInt16_FormatException_Test_28()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { UInt16.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { UInt16.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { UInt16.Parse(rdmString); });
}
}

Expand All @@ -641,12 +641,12 @@ public void ParseInt32_FormatException_Test_29()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { Int32.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { Int32.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { Int32.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { Int32.Parse(rdmString); });
}
}

Expand All @@ -656,12 +656,12 @@ public void ParseUInt32_FormatException_Test_30()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { UInt32.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { UInt32.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { UInt32.Parse(rdmString); });
}
}

Expand All @@ -671,12 +671,12 @@ public void ParseInt64_FormatException_Test_31()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { Int64.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { Int64.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { Int64.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { Int64.Parse(rdmString); });
}
}

Expand All @@ -686,12 +686,12 @@ public void ParseUInt64_FormatException_Test_32()
String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" };
for (int i = 0; i < strArr.Length; i++)
{
Assert.Trows(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
Assert.Throws(typeof(Exception), () => { UInt64.Parse(strArr[i]); });
}
for (int i = 0; i < 5; i++)
{
String rdmString = GetRandomString();
Assert.Trows(typeof(Exception), () => { UInt64.Parse(rdmString); });
Assert.Throws(typeof(Exception), () => { UInt64.Parse(rdmString); });
}
}

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

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

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

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

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

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

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

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

Expand Down Expand Up @@ -850,27 +850,27 @@ public void box_unbox_Test_1()
Guid guid = (Guid)o_guid;

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

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

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

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

// Now casts that should throw exception. Any cast that does not throw - means error.
Assert.Trows(typeof(InvalidCastException), () => {
Assert.Throws(typeof(InvalidCastException), () => {
int i = (int)o_guid;
});
}
Expand Down
Loading

0 comments on commit 12b88f1

Please sign in to comment.