[VisualBasic] Fix tests for Android (#41378)
authorEdison Henrique Andreassy <ehasis@hotmail.com>
Wed, 26 Aug 2020 21:57:05 +0000 (22:57 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Aug 2020 21:57:05 +0000 (23:57 +0200)
Remove some empty tests and add data for others. Resolves #37066

src/libraries/Microsoft.VisualBasic.Core/tests/CharTypeTests.cs
src/libraries/Microsoft.VisualBasic.Core/tests/ConversionTests.cs
src/libraries/Microsoft.VisualBasic.Core/tests/DateTypeTests.cs
src/libraries/Microsoft.VisualBasic.Core/tests/LongTypeTests.cs
src/libraries/Microsoft.VisualBasic.Core/tests/SingleTypeTests.cs

index 0585c8a..ef8d01d 100644 (file)
@@ -26,33 +26,12 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
         }
 
         [Theory]
-        [MemberData(nameof(FromObject_Overflow_TestData))]
-        public void FromObject_ThrowsOverflowException(object value)
-        {
-            Assert.Throws<OverflowException>(() => CharType.FromObject(value));
-        }
-
-        [Theory]
         [MemberData(nameof(FromString_TestData))]
         public void FromString(string value, char expected)
         {
             Assert.Equal(expected, CharType.FromString(value));
         }
 
-        [Theory]
-        [MemberData(nameof(FromString_Invalid_TestData))]
-        public void FromString_ThrowsInvalidCastException(string value)
-        {
-            Assert.Throws<InvalidCastException>(() => CharType.FromString(value));
-        }
-
-        [Theory]
-        [MemberData(nameof(FromString_Overflow_TestData))]
-        public void FromString_ThrowsOverflowException(string value)
-        {
-            Assert.Throws<OverflowException>(() => CharType.FromString(value));
-        }
-
         public static IEnumerable<object[]> FromObject_TestData()
         {
             // char.
@@ -159,11 +138,6 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
             yield return new object[] { new object() };
         }
 
-        public static IEnumerable<object[]> FromObject_Overflow_TestData()
-        {
-            yield break;
-        }
-
         public static IEnumerable<object[]> FromString_TestData()
         {
             yield return new object[] { null, char.MinValue };
@@ -186,15 +160,5 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
             yield return new object[] { "18446744073709551616", '1' };
             yield return new object[] { "1844674407370955161618446744073709551616", '1' };
         }
-
-        public static IEnumerable<object[]> FromString_Invalid_TestData()
-        {
-            yield break;
-        }
-
-        public static IEnumerable<object[]> FromString_Overflow_TestData()
-        {
-            yield break;
-        }
     }
 }
index c948daf..c280054 100644 (file)
@@ -476,17 +476,23 @@ namespace Microsoft.VisualBasic.Tests
 
         public static IEnumerable<object[]> Hex_Single_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (float)0, "0" };
+            yield return new object[] { (float)1, "1" };
+            yield return new object[] { (float)15, "F" };
         }
 
         public static IEnumerable<object[]> Hex_Double_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (double)0, "0" };
+            yield return new object[] { (double)1, "1" };
+            yield return new object[] { (double)15, "F" };
         }
 
         public static IEnumerable<object[]> Hex_Decimal_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (decimal)0, "0" };
+            yield return new object[] { (decimal)1, "1" };
+            yield return new object[] { (decimal)15, "F" };
         }
 
         [Theory]
@@ -812,17 +818,23 @@ namespace Microsoft.VisualBasic.Tests
 
         public static IEnumerable<object[]> Oct_Single_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (float)0, "0" };
+            yield return new object[] { (float)1, "1" };
+            yield return new object[] { (float)15, "17" };
         }
 
         public static IEnumerable<object[]> Oct_Double_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (double)0, "0" };
+            yield return new object[] { (double)1, "1" };
+            yield return new object[] { (double)15, "17" };
         }
 
         public static IEnumerable<object[]> Oct_Decimal_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { (decimal)0, "0" };
+            yield return new object[] { (decimal)1, "1" };
+            yield return new object[] { (decimal)15, "17" };
         }
 
         [Theory]
@@ -894,20 +906,6 @@ namespace Microsoft.VisualBasic.Tests
         }
 
         [Theory]
-        [MemberData(nameof(Val_Char_ArgumentException_TestData))]
-        public void Val_ArgumentException_Char(char value)
-        {
-            Assert.Throws<ArgumentException>(() => Conversion.Val(value));
-        }
-
-        [Theory]
-        [MemberData(nameof(Val_Char_OverflowException_TestData))]
-        public void Val_OverflowException_Char(char value)
-        {
-            Assert.Throws<OverflowException>(() => Conversion.Val(value));
-        }
-
-        [Theory]
         [MemberData(nameof(Val_String_TestData))]
         public void Val_String_Double(string value, double expected)
         {
@@ -915,13 +913,6 @@ namespace Microsoft.VisualBasic.Tests
         }
 
         [Theory]
-        [MemberData(nameof(Val_String_ArgumentException_TestData))]
-        public void Val_ArgumentException_String(string value)
-        {
-            Assert.Throws<ArgumentException>(() => Conversion.Val(value));
-        }
-
-        [Theory]
         [MemberData(nameof(Val_String_InvalidCastException_TestData))]
         public void Val_InvalidCastException(string value)
         {
@@ -943,12 +934,12 @@ namespace Microsoft.VisualBasic.Tests
 
         public static IEnumerable<object[]> Val_Object_ArgumentException_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { new object() };
         }
 
         public static IEnumerable<object[]> Val_Object_OverflowException_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { "123456e789" };
         }
 
         public static IEnumerable<object[]> Val_Char_TestData()
@@ -968,16 +959,6 @@ namespace Microsoft.VisualBasic.Tests
             yield return new object[] { char.MaxValue, 0 };
         }
 
-        public static IEnumerable<object[]> Val_Char_ArgumentException_TestData()
-        {
-            yield break; // Add more...
-        }
-
-        public static IEnumerable<object[]> Val_Char_OverflowException_TestData()
-        {
-            yield break; // Add more...
-        }
-
         public static IEnumerable<object[]> Val_String_TestData()
         {
             yield return new object[] { null, 0.0 };
@@ -1019,11 +1000,6 @@ namespace Microsoft.VisualBasic.Tests
             yield return new object[] { "&O37777777777&", -1.0 };
         }
 
-        public static IEnumerable<object[]> Val_String_ArgumentException_TestData()
-        {
-            yield break; // Add more...
-        }
-
         public static IEnumerable<object[]> Val_String_InvalidCastException_TestData()
         {
             yield return new object[] { "1.0%" };
@@ -1032,7 +1008,7 @@ namespace Microsoft.VisualBasic.Tests
 
         public static IEnumerable<object[]> Val_String_OverflowException_TestData()
         {
-            yield break; // Add more...
+            yield return new object[] { "123456e789" };
         }
 
         public static IEnumerable<object[]> Various_ArgumentException_TestData()
index ebd9148..313f039 100644 (file)
@@ -34,13 +34,6 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
         }
 
         [Theory]
-        [MemberData(nameof(FromObject_Overflow_TestData))]
-        public void FromObject_ThrowsOverflowException(object value)
-        {
-            Assert.Throws<OverflowException>(() => DateType.FromObject(value));
-        }
-
-        [Theory]
         [MemberData(nameof(FromString_TestData))]
         public void FromString(string value, DateTime expected)
         {
@@ -63,13 +56,6 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
             Assert.Throws<InvalidCastException>(() => DateType.FromString(value));
         }
 
-        [Theory]
-        [MemberData(nameof(FromString_Overflow_TestData))]
-        public void FromString_ThrowsOverflowException(string value)
-        {
-            Assert.Throws<OverflowException>(() => DateType.FromString(value));
-        }
-
         public static IEnumerable<object[]> FromObject_TestData()
         {
             // null.
@@ -172,12 +158,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
 
         public static IEnumerable<object[]> FromObject_Invalid_TestData()
         {
-            yield break;
-        }
-
-        public static IEnumerable<object[]> FromObject_Overflow_TestData()
-        {
-            yield break;
+            yield return new object[] { new object() };
         }
 
         public static IEnumerable<object[]> FromString_TestData()
@@ -208,10 +189,5 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
             yield return new object[] { "false" };
             yield return new object[] { "invalid" };
         }
-
-        public static IEnumerable<object[]> FromString_Overflow_TestData()
-        {
-            yield break;
-        }
     }
 }
index 3e01bae..55453c7 100644 (file)
@@ -231,7 +231,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
 
         public static IEnumerable<object[]> FromString_Overflow_TestData()
         {
-            yield break;
+            yield return new object[] { "12345678901234567890" };
         }
     }
 }
index cb43f2d..89ed4fe 100644 (file)
@@ -213,7 +213,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
 
         public static IEnumerable<object[]> FromObject_Overflow_TestData()
         {
-            yield break;
+            yield return new object[] { "1234567890123456789012345678901234567890" };
         }
 
         public static IEnumerable<object[]> FromString_TestData()