mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
Add failing tests
This commit is contained in:
@@ -349,6 +349,7 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JIT/@EntryIndexedValue">JIT</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NRT/@EntryIndexedValue">NRT</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PM/@EntryIndexedValue">PM</s:String>
|
||||
|
||||
@@ -107,6 +107,97 @@ namespace osu.Framework.Tests.Bindables
|
||||
Assert.That(value, Is.EqualTo(output));
|
||||
}
|
||||
|
||||
// Bindable<int>.Parse(null)
|
||||
[Test]
|
||||
public void TestParseNullIntoValueType()
|
||||
{
|
||||
Bindable<int> bindable = new Bindable<int>();
|
||||
Assert.That(() => bindable.Parse(null), Throws.ArgumentNullException);
|
||||
}
|
||||
|
||||
// Bindable<int?>.Parse(null)
|
||||
[Test]
|
||||
public void TestParseNullIntoNullableValueType()
|
||||
{
|
||||
Bindable<int?> bindable = new Bindable<int?>();
|
||||
bindable.Parse(null);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<int>.Parse(string.Empty)
|
||||
[Test]
|
||||
public void TestParseEmptyStringIntoValueType()
|
||||
{
|
||||
Bindable<int> bindable = new Bindable<int>();
|
||||
bindable.Parse(string.Empty);
|
||||
Assert.That(bindable.Value, Is.Zero);
|
||||
}
|
||||
|
||||
// Bindable<int?>.Parse(string.Empty)
|
||||
[Test]
|
||||
public void TestParseEmptyStringIntoNullableValueType()
|
||||
{
|
||||
Bindable<int?> bindable = new Bindable<int?>();
|
||||
bindable.Parse(string.Empty);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<Class>.Parse(null)
|
||||
[Test]
|
||||
public void TestParseNullIntoReferenceType()
|
||||
{
|
||||
Bindable<TestClass> bindable = new Bindable<TestClass>();
|
||||
bindable.Parse(null);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<Class>.Parse(string.Empty)
|
||||
[Test]
|
||||
public void TestParseEmptyStringIntoReferenceType()
|
||||
{
|
||||
Bindable<TestClass> bindable = new Bindable<TestClass>();
|
||||
bindable.Parse(string.Empty);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
// Bindable<Class>.Parse(null) -- NRT
|
||||
[Test]
|
||||
public void TestParseNullIntoReferenceTypeWithNRT()
|
||||
{
|
||||
Bindable<TestClass> bindable = new Bindable<TestClass>();
|
||||
bindable.Parse(null);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<Class?>.Parse(null) -- NRT
|
||||
[Test]
|
||||
public void TestParseNullIntoNullableReferenceTypeWithNRT()
|
||||
{
|
||||
Bindable<TestClass?> bindable = new Bindable<TestClass?>();
|
||||
bindable.Parse(null);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<Class>.Parse(string.Empty) -- NRT
|
||||
[Test]
|
||||
public void TestParseEmptyStringIntoReferenceTypeWithNRT()
|
||||
{
|
||||
Bindable<TestClass> bindable = new Bindable<TestClass>();
|
||||
bindable.Parse(string.Empty);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
|
||||
// Bindable<Class?>.Parse(string.Empty) -- NRT
|
||||
[Test]
|
||||
public void TestParseEmptyStringIntoNullableReferenceTypeWithNRT()
|
||||
{
|
||||
Bindable<TestClass?> bindable = new Bindable<TestClass?>();
|
||||
bindable.Parse(string.Empty);
|
||||
Assert.That(bindable.Value, Is.Null);
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
private static IEnumerable<object[]> getParsingConversionTests()
|
||||
{
|
||||
var testTypes = new[]
|
||||
@@ -156,5 +247,9 @@ namespace osu.Framework.Tests.Bindables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TestClass
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user