Update asserts to use better nunit specifications

This commit is contained in:
Dean Herbert 2021-04-13 15:04:01 +09:00
parent 4837cef095
commit b45d7de4ec
2 changed files with 14 additions and 31 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit.Checks.Components;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Checks;
@ -42,9 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
}
};
var issues = check.Run(beatmap);
Assert.That(!issues.Any());
Assert.That(check.Run(beatmap), Is.Empty);
}
[Test]
@ -62,9 +61,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
}
};
var issues = check.Run(beatmap);
Assert.That(!issues.Any());
Assert.That(check.Run(beatmap), Is.Empty);
}
[Test]
@ -124,9 +121,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
}
};
var issues = check.Run(beatmap);
Assert.That(!issues.Any());
Assert.That(check.Run(beatmap), Is.Empty);
}
[Test]
@ -149,9 +144,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
}
};
var issues = check.Run(beatmap);
Assert.That(!issues.Any());
Assert.That(check.Run(beatmap), Is.Empty);
}
[Test]
@ -252,21 +245,17 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
private void assertOffscreenCircle(IBeatmap beatmap)
{
var issues = check.Run(beatmap).ToList();
var issue = issues.FirstOrDefault();
Assert.That(issues.Count == 1);
Assert.That(issue != null);
Assert.That(issue.Template is CheckOffscreenObjects.IssueTemplateOffscreenCircle);
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenCircle);
}
private void assertOffscreenSlider(IBeatmap beatmap)
{
var issues = check.Run(beatmap).ToList();
var issue = issues.FirstOrDefault();
Assert.That(issues.Count == 1);
Assert.That(issue != null);
Assert.That(issue.Template is CheckOffscreenObjects.IssueTemplateOffscreenSlider);
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckOffscreenObjects.IssueTemplateOffscreenSlider);
}
}
}

View File

@ -39,9 +39,7 @@ namespace osu.Game.Tests.Editing.Checks
[Test]
public void TestBackgroundSetAndInFiles()
{
var issues = check.Run(beatmap);
Assert.That(!issues.Any());
Assert.That(check.Run(beatmap), Is.Empty);
}
[Test]
@ -50,11 +48,9 @@ namespace osu.Game.Tests.Editing.Checks
beatmap.BeatmapInfo.BeatmapSet.Files.Clear();
var issues = check.Run(beatmap).ToList();
var issue = issues.FirstOrDefault();
Assert.That(issues.Count == 1);
Assert.That(issue != null);
Assert.That(issue.Template is CheckBackground.IssueTemplateDoesNotExist);
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckBackground.IssueTemplateDoesNotExist);
}
[Test]
@ -63,11 +59,9 @@ namespace osu.Game.Tests.Editing.Checks
beatmap.Metadata.BackgroundFile = null;
var issues = check.Run(beatmap).ToList();
var issue = issues.FirstOrDefault();
Assert.That(issues.Count == 1);
Assert.That(issue != null);
Assert.That(issue.Template is CheckBackground.IssueTemplateNoneSet);
Assert.That(issues, Has.Count.EqualTo(1));
Assert.That(issues.Single().Template is CheckBackground.IssueTemplateNoneSet);
}
}
}