Initial EF Core commit

This commit is contained in:
TocoToucan
2017-10-04 22:52:12 +03:00
parent de840a5c9e
commit 6a4198d0d6
93 changed files with 730 additions and 708 deletions

View File

@ -24,12 +24,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo
{
Version = "All Metrics",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has all the metrics",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 7,
DrainRate = 1,
@ -48,12 +48,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo
{
Version = "Only Ratings",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 6,
DrainRate = 9,
@ -70,12 +70,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo
{
Version = "Only Retries and Fails",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 3.7f,
DrainRate = 6,
@ -93,12 +93,12 @@ namespace osu.Game.Tests.Visual
AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo
{
Version = "No Metrics",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has no metrics",
},
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,

View File

@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
{
overlay.ShowBeatmapSet(new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Lachryma <Re:QueenM>",
Artist = @"Kaneko Chiharu",
@ -64,8 +64,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 1.36,
Version = @"BASIC",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 6.5f,
@ -92,8 +92,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 2.22,
Version = @"NOVICE",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 7,
@ -120,8 +120,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.49,
Version = @"ADVANCED",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 7.5f,
@ -148,8 +148,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 4.24,
Version = @"EXHAUST",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 8,
@ -176,8 +176,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 5.26,
Version = @"GRAVITY",
Ruleset = mania,
Difficulty = new BeatmapDifficulty
RulesetInfo = mania,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 4,
DrainRate = 8.5f,
@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual
{
overlay.ShowBeatmapSet(new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Soumatou Labyrinth",
Artist = @"Yunomi with Momobako&miko",
@ -238,8 +238,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 1.40,
Version = @"yzrin's Kantan",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 7,
@ -266,8 +266,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 2.23,
Version = @"Futsuu",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 6,
@ -294,8 +294,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.19,
Version = @"Muzukashii",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 2,
DrainRate = 6,
@ -322,8 +322,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 3.97,
Version = @"Charlotte's Oni",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 6,
@ -350,8 +350,8 @@ namespace osu.Game.Tests.Visual
{
StarDifficulty = 5.08,
Version = @"Labyrinth Oni",
Ruleset = taiko,
Difficulty = new BeatmapDifficulty
RulesetInfo = taiko,
BeatmapDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,

View File

@ -41,8 +41,8 @@ namespace osu.Game.Tests.Visual
{
new BeatmapSetInfo
{
OnlineBeatmapSetID = 578332,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 578332,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"OrVid",
Artist = @"An",
@ -65,16 +65,16 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.35f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 599627,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 599627,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"tiny lamp",
Artist = @"fhana",
@ -97,16 +97,16 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.81f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 513268,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 513268,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"At Gwanghwamun",
Artist = @"KYUHYUN",
@ -129,31 +129,31 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 0.9f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 1.1f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.02f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.49f,
},
},
},
new BeatmapSetInfo
{
OnlineBeatmapSetID = 586841,
Metadata = new BeatmapMetadata
BeatmapSetOnlineInfoId = 586841,
BeatmapMetadata = new BeatmapMetadata
{
Title = @"RHAPSODY OF BLUE SKY",
Artist = @"fhana",
@ -176,43 +176,43 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 1.26f,
Metadata = new BeatmapMetadata(),
BeatmapMetadata = new BeatmapMetadata(),
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.01f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 2.87f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.76f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 3.93f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 4.37f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.13f,
},
new BeatmapInfo
{
Ruleset = ruleset,
RulesetInfo = ruleset,
StarDifficulty = 5.42f,
},
},

View File

@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 4.65,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Critical Crystal",
Artist = @"Seiryu",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -81,13 +81,13 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 1.96,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Serendipity",
Artist = @"ZAQ",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
@ -37,12 +38,11 @@ namespace osu.Game.Tests.Visual
{
var storage = new TestStorage(@"TestCasePlaySongSelect");
var backingDatabase = storage.GetDatabase(@"client");
backingDatabase.CreateTable<StoreVersion>();
var dbConnectionString = storage.GetDatabaseConnectionString(@"client");
dependencies.Cache(rulesets = new RulesetStore(backingDatabase));
dependencies.Cache(files = new FileStore(backingDatabase, storage));
dependencies.Cache(manager = new BeatmapManager(storage, files, backingDatabase, rulesets, null));
dependencies.Cache(rulesets = new RulesetStore(new OsuDbContext(dbConnectionString)));
dependencies.Cache(files = new FileStore(new OsuDbContext(dbConnectionString), storage));
dependencies.Cache(manager = new BeatmapManager(storage, files, new OsuDbContext(dbConnectionString), rulesets, null));
for (int i = 0; i < 100; i += 10)
manager.Import(createTestBeatmapSet(i));
@ -60,11 +60,11 @@ namespace osu.Game.Tests.Visual
{
return new BeatmapSetInfo
{
OnlineBeatmapSetID = 1234 + i,
BeatmapSetOnlineInfoId = 1234 + i,
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
Metadata = new BeatmapMetadata
BeatmapMetadata = new BeatmapMetadata
{
OnlineBeatmapSetID = 1234 + i,
BeatmapSetOnlineInfoId = 1234 + i,
// Create random metadata, then we can check if sorting works based on these
Artist = "MONACA " + RNG.Next(0, 9),
Title = "Black Song " + RNG.Next(0, 9),
@ -74,33 +74,33 @@ namespace osu.Game.Tests.Visual
{
new BeatmapInfo
{
OnlineBeatmapID = 1234 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1234 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "normal.osu",
Version = "Normal",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 3.5f,
}
},
new BeatmapInfo
{
OnlineBeatmapID = 1235 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1235 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "hard.osu",
Version = "Hard",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 5,
}
},
new BeatmapInfo
{
OnlineBeatmapID = 1236 + i,
Ruleset = rulesets.Query<RulesetInfo>().First(),
BeatmapOnlineInfoId = 1236 + i,
RulesetInfo = rulesets.QueryRulesets().First(),
Path = "insane.osu",
Version = "Insane",
Difficulty = new BeatmapDifficulty
BeatmapDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 7,
}

View File

@ -39,10 +39,11 @@ namespace osu.Game.Tests.Visual
Colour = Color4.Black,
});
foreach (var r in rulesets.Query<RulesetInfo>())
var queryRulesets = rulesets.QueryRulesets(r=>true);
foreach (var r in queryRulesets)
AddStep(r.Name, () => loadPlayerFor(r));
loadPlayerFor(rulesets.Query<RulesetInfo>().First());
loadPlayerFor(queryRulesets.First());
}
protected virtual Beatmap CreateBeatmap()
@ -60,7 +61,7 @@ namespace osu.Game.Tests.Visual
{
var beatmap = CreateBeatmap();
beatmap.BeatmapInfo.Ruleset = r;
beatmap.BeatmapInfo.RulesetInfo = r;
var instance = r.CreateInstance();

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual
if (beatmap == null)
{
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetInfoId == 0);
if (beatmapInfo != null)
beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo);
}

View File

@ -32,14 +32,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 3.7,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(3),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"Platina",
Artist = @"Maaya Sakamoto",
Author = @"uwutm8",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -99,14 +99,14 @@ namespace osu.Game.Tests.Visual
Value = new BeatmapInfo
{
StarDifficulty = 7.07,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
RulesetInfo = rulesets.GetRuleset(0),
BeatmapMetadata = new BeatmapMetadata
{
Title = @"FREEDOM DIVE",
Artist = @"xi",
Author = @"Nakagawa-Kanon",
},
BeatmapSet = new BeatmapSetInfo
BeatmapSetInfo = new BeatmapSetInfo
{
OnlineInfo = new BeatmapSetOnlineInfo
{

View File

@ -48,8 +48,8 @@ namespace osu.Game.Tests.Visual
HitObjects = objects,
BeatmapInfo = new BeatmapInfo
{
Difficulty = new BeatmapDifficulty(),
Metadata = new BeatmapMetadata()
BeatmapDifficulty = new BeatmapDifficulty(),
BeatmapMetadata = new BeatmapMetadata()
}
};