Refactor tests

This commit is contained in:
smoogipoo 2019-09-05 16:55:24 +09:00
parent bda21998c4
commit 8e204ba2e9

View File

@ -44,24 +44,24 @@ namespace osu.Game.Tests.Skins
}
[Test]
public void TestParsingLookup()
public void TestFloatLookup()
{
AddStep("Add config values", () =>
{
source1.Configuration.ConfigDictionary["FloatTest"] = "1.1";
source2.Configuration.ConfigDictionary["BoolTest"] = "1";
});
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["FloatTest"] = "1.1");
AddAssert("Check float parse lookup", () => requester.GetConfig<string, float>("FloatTest")?.Value == 1.1f);
}
[Test]
public void TestBoolLookup()
{
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["BoolTest"] = "1");
AddAssert("Check bool parse lookup", () => requester.GetConfig<string, bool>("BoolTest")?.Value == true);
}
[Test]
public void TestEnumLookup()
{
AddStep("Add config values", () => { source1.Configuration.ConfigDictionary["Test"] = "Test2"; });
AddAssert("Check float parse lookup", () => requester.GetConfig<LookupType, ValueType>(LookupType.Test)?.Value == ValueType.Test2);
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["Test"] = "Test2");
AddAssert("Check enum parse lookup", () => requester.GetConfig<LookupType, ValueType>(LookupType.Test)?.Value == ValueType.Test2);
}
[Test]
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Skins
[Test]
public void TestLookupNull()
{
AddStep("Add config values", () => { source1.Configuration.ConfigDictionary["Lookup"] = null; });
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["Lookup"] = null);
AddAssert("Check lookup null", () =>
{
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Skins
[Test]
public void TestColourLookup()
{
AddStep("Add config colour", () => { source1.Configuration.CustomColours["Lookup"] = Color4.Red; });
AddStep("Add config colour", () => source1.Configuration.CustomColours["Lookup"] = Color4.Red);
AddAssert("Check colour lookup", () => requester.GetConfig<SkinCustomColourLookup, Color4>(new SkinCustomColourLookup("Lookup"))?.Value == Color4.Red);
}
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Skins
[Test]
public void TestWrongColourType()
{
AddStep("Add config colour", () => { source1.Configuration.CustomColours["Lookup"] = Color4.Red; });
AddStep("Add config colour", () => source1.Configuration.CustomColours["Lookup"] = Color4.Red);
AddAssert("perform incorrect lookup", () =>
{