Skip to content

Commit

Permalink
null check in test
Browse files Browse the repository at this point in the history
  • Loading branch information
cdwcgt committed Jul 29, 2023
1 parent 8a06914 commit 4c33013
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions osu.Game.Tournament.Tests/Screens/TestSceneMapPoolScreen.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

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;
Expand All @@ -16,7 +15,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
public partial class TestSceneMapPoolScreen : TournamentScreenTestScene
{
private MapPoolScreen screen;
private MapPoolScreen screen = null!;

[BackgroundDependencyLoader]
private void load()
Expand All @@ -32,7 +31,7 @@ public void TestFewMaps()
{
AddStep("load few maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 8; i++)
addBeatmap();
Expand All @@ -52,7 +51,7 @@ public void TestJustEnoughMaps()
{
AddStep("load just enough maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 18; i++)
addBeatmap();
Expand All @@ -72,7 +71,7 @@ public void TestManyMaps()
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 19; i++)
addBeatmap();
Expand All @@ -92,7 +91,7 @@ public void TestJustEnoughMods()
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 11; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
Expand All @@ -118,7 +117,7 @@ public void TestManyMods()
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 12; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
Expand All @@ -138,7 +137,7 @@ public void TestSplitMapPoolByMods()
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();

for (int i = 0; i < 12; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
Expand All @@ -155,7 +154,7 @@ public void TestSplitMapPoolByMods()

private void addBeatmap(string mods = "NM")
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Add(new RoundBeatmap
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Add(new RoundBeatmap
{
Beatmap = CreateSampleBeatmap(),
Mods = mods
Expand Down

0 comments on commit 4c33013

Please sign in to comment.