Skip to content

Commit d81434a

Browse files
committed
Move stuff around in union with other tests
1 parent 8a4f071 commit d81434a

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/TextDecorationCollectionConverter.Tests.cs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,35 @@ namespace System.Windows;
88
public class TextDecorationCollectionConverterTests
99
{
1010
[Theory]
11-
[MemberData(nameof(ConvertFromString_TestData))]
11+
// Only valid type
12+
[InlineData(true, typeof(string))]
13+
// Invalid types
14+
[InlineData(false, typeof(TextDecorationCollection))]
15+
[InlineData(false, typeof(IEnumerable<TextDecoration>))]
16+
[InlineData(false, typeof(InstanceDescriptor))]
17+
public void CanConvertFrom_ReturnsExpected(bool expected, Type sourceType)
18+
{
19+
TextDecorationCollectionConverter converter = new();
20+
21+
Assert.Equal(expected, converter.CanConvertFrom(sourceType));
22+
}
23+
24+
[Theory]
25+
// Only valid type
26+
[InlineData(true, typeof(InstanceDescriptor))]
27+
// Invalid types
28+
[InlineData(false, typeof(TextDecorationCollection))]
29+
[InlineData(false, typeof(IEnumerable<TextDecoration>))]
30+
[InlineData(false, typeof(string))]
31+
public void CanConvertTo_ReturnsExpected(bool expected, Type destinationType)
32+
{
33+
TextDecorationCollectionConverter converter = new();
34+
35+
Assert.Equal(expected, converter.CanConvertTo(destinationType));
36+
}
37+
38+
[Theory]
39+
[MemberData(nameof(ConvertFromString_ReturnsExpected_Data))]
1240
public void ConvertFromString_ReturnsExpected(TextDecorationCollection expected, string text)
1341
{
1442
TextDecorationCollection converted = TextDecorationCollectionConverter.ConvertFromString(text);
@@ -23,16 +51,7 @@ public void ConvertFromString_ReturnsExpected(TextDecorationCollection expected,
2351
}
2452
}
2553

26-
[Fact]
27-
public void ConvertFromString_NullValue_ReturnsNull()
28-
{
29-
// null is simply null (NOTE: This differs from instance method ConvertFrom, that will throw on null value)
30-
TextDecorationCollection? converted = TextDecorationCollectionConverter.ConvertFromString(null);
31-
32-
Assert.Null(converted);
33-
}
34-
35-
public static IEnumerable<object?[]> ConvertFromString_TestData
54+
public static IEnumerable<object?[]> ConvertFromString_ReturnsExpected_Data
3655
{
3756
get
3857
{
@@ -57,6 +76,15 @@ public static IEnumerable<object?[]> ConvertFromString_TestData
5776
}
5877
}
5978

79+
[Fact]
80+
public void ConvertFromString_NullValue_ReturnsNull()
81+
{
82+
// null is simply null (NOTE: This differs from instance method ConvertFrom, that will throw on null value)
83+
TextDecorationCollection? converted = TextDecorationCollectionConverter.ConvertFromString(null);
84+
85+
Assert.Null(converted);
86+
}
87+
6088
[Theory]
6189
// Starts with a separator
6290
[InlineData(", Strikethrough ,Underline, Baseline ")]
@@ -77,34 +105,6 @@ public void ConvertFromString_ThrowsArgumentException(string text)
77105
Assert.Throws<ArgumentException>(() => TextDecorationCollectionConverter.ConvertFromString(text));
78106
}
79107

80-
[Theory]
81-
// Only valid type
82-
[InlineData(true, typeof(InstanceDescriptor))]
83-
// Invalid types
84-
[InlineData(false, typeof(TextDecorationCollection))]
85-
[InlineData(false, typeof(IEnumerable<TextDecoration>))]
86-
[InlineData(false, typeof(string))]
87-
public void CanConvertTo_ReturnsExpected(bool expected, Type destinationType)
88-
{
89-
TextDecorationCollectionConverter converter = new();
90-
91-
Assert.Equal(expected, converter.CanConvertTo(destinationType));
92-
}
93-
94-
[Theory]
95-
// Only valid type
96-
[InlineData(true, typeof(string))]
97-
// Invalid types
98-
[InlineData(false, typeof(TextDecorationCollection))]
99-
[InlineData(false, typeof(IEnumerable<TextDecoration>))]
100-
[InlineData(false, typeof(InstanceDescriptor))]
101-
public void CanConvertFrom_ReturnsExpected(bool expected, Type sourceType)
102-
{
103-
TextDecorationCollectionConverter converter = new();
104-
105-
Assert.Equal(expected, converter.CanConvertFrom(sourceType));
106-
}
107-
108108
[Theory]
109109
[MemberData(nameof(ConvertTo_ThrowsArgumentNullException_TestData))]
110110
public void ConvertTo_ThrowsArgumentNullException(object value, Type destinationType)

0 commit comments

Comments
 (0)