mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 11:02:57 +08:00
Improve test comparison logic
Doesn't really help that much with nunit output, but at least you can breakpoint and see the json kinda.
This commit is contained in:
parent
57cd5194ce
commit
2e48569982
@ -4,6 +4,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Unicode;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -214,7 +217,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
});
|
||||
|
||||
AddStep("Press undo", () => InputManager.Keys(PlatformAction.Undo));
|
||||
AddAssert("Nothing changed", () => defaultState.SequenceEqual(changeHandler.GetCurrentState()));
|
||||
|
||||
AddAssert("Nothing changed",
|
||||
() => JsonConvert.DeserializeObject<IEnumerable<SerialisedDrawableInfo>>(Encoding.UTF8.GetString(defaultState)),
|
||||
() => Is.EqualTo(JsonConvert.DeserializeObject<IEnumerable<SerialisedDrawableInfo>>(Encoding.UTF8.GetString(changeHandler.GetCurrentState())))
|
||||
);
|
||||
|
||||
AddStep("Add components", () =>
|
||||
{
|
||||
@ -243,7 +250,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
void revertAndCheckUnchanged()
|
||||
{
|
||||
AddStep("Revert changes", () => changeHandler.RestoreState(int.MinValue));
|
||||
AddAssert("Current state is same as default", () => defaultState.SequenceEqual(changeHandler.GetCurrentState()));
|
||||
|
||||
AddAssert("Current state is same as default",
|
||||
() => JsonConvert.DeserializeObject<IEnumerable<SerialisedDrawableInfo>>(Encoding.UTF8.GetString(defaultState)),
|
||||
() => Is.EqualTo(JsonConvert.DeserializeObject<IEnumerable<SerialisedDrawableInfo>>(Encoding.UTF8.GetString(changeHandler.GetCurrentState())))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user