mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Revert some usages of AsNonNull()
in tests
We generally prefer `!` when it is unambiguous usage (ie. direct access).
This commit is contained in:
parent
5ad80879b7
commit
6549ca5304
@ -3,7 +3,6 @@
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Tournament.Models;
|
||||
|
||||
namespace osu.Game.Tournament.Tests.NonVisual
|
||||
@ -36,8 +35,8 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
PlayersPerTeam = { Value = 4 },
|
||||
Teams =
|
||||
{
|
||||
match.Team1.Value.AsNonNull(),
|
||||
match.Team2.Value.AsNonNull(),
|
||||
match.Team1.Value!,
|
||||
match.Team2.Value!,
|
||||
},
|
||||
Rounds =
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Tournament.Components;
|
||||
@ -31,7 +30,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load few maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
addBeatmap();
|
||||
@ -51,7 +50,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load just enough maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 18; i++)
|
||||
addBeatmap();
|
||||
@ -71,7 +70,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load many maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 19; i++)
|
||||
addBeatmap();
|
||||
@ -91,7 +90,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load many maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
|
||||
@ -117,7 +116,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load many maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
|
||||
@ -137,7 +136,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("load many maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
|
||||
@ -154,7 +153,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
|
||||
private void addBeatmap(string mods = "NM")
|
||||
{
|
||||
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Add(new RoundBeatmap
|
||||
Ladder.CurrentMatch.Value!.Round.Value!.Beatmaps.Add(new RoundBeatmap
|
||||
{
|
||||
Beatmap = CreateSampleBeatmap(),
|
||||
Mods = mods
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
@ -41,10 +40,10 @@ namespace osu.Game.Tournament.Tests
|
||||
|
||||
match = CreateSampleMatch();
|
||||
|
||||
Ladder.Rounds.Add(match.Round.Value.AsNonNull());
|
||||
Ladder.Rounds.Add(match.Round.Value!);
|
||||
Ladder.Matches.Add(match);
|
||||
Ladder.Teams.Add(match.Team1.Value.AsNonNull());
|
||||
Ladder.Teams.Add(match.Team2.Value.AsNonNull());
|
||||
Ladder.Teams.Add(match.Team1.Value!);
|
||||
Ladder.Teams.Add(match.Team2.Value!);
|
||||
|
||||
Ruleset.BindTo(Ladder.Ruleset);
|
||||
Dependencies.CacheAs(new StableInfo(storage));
|
||||
|
Loading…
Reference in New Issue
Block a user