mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 07:07:18 +09:00
Refactor tests
This commit is contained in:
parent
bda21998c4
commit
8e204ba2e9
@ -44,24 +44,24 @@ namespace osu.Game.Tests.Skins
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestParsingLookup()
|
public void TestFloatLookup()
|
||||||
{
|
{
|
||||||
AddStep("Add config values", () =>
|
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["FloatTest"] = "1.1");
|
||||||
{
|
|
||||||
source1.Configuration.ConfigDictionary["FloatTest"] = "1.1";
|
|
||||||
source2.Configuration.ConfigDictionary["BoolTest"] = "1";
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAssert("Check float parse lookup", () => requester.GetConfig<string, float>("FloatTest")?.Value == 1.1f);
|
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);
|
AddAssert("Check bool parse lookup", () => requester.GetConfig<string, bool>("BoolTest")?.Value == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestEnumLookup()
|
public void TestEnumLookup()
|
||||||
{
|
{
|
||||||
AddStep("Add config values", () => { source1.Configuration.ConfigDictionary["Test"] = "Test2"; });
|
AddStep("Add config values", () => source1.Configuration.ConfigDictionary["Test"] = "Test2");
|
||||||
|
AddAssert("Check enum parse lookup", () => requester.GetConfig<LookupType, ValueType>(LookupType.Test)?.Value == ValueType.Test2);
|
||||||
AddAssert("Check float parse lookup", () => requester.GetConfig<LookupType, ValueType>(LookupType.Test)?.Value == ValueType.Test2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLookupNull()
|
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", () =>
|
AddAssert("Check lookup null", () =>
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestColourLookup()
|
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);
|
AddAssert("Check colour lookup", () => requester.GetConfig<SkinCustomColourLookup, Color4>(new SkinCustomColourLookup("Lookup"))?.Value == Color4.Red);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestWrongColourType()
|
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", () =>
|
AddAssert("perform incorrect lookup", () =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user