Merge pull request #2544 from smoogipoo/fix-testruleset-issues

Fix possibility of test rulesets being discovered from assemblies
This commit is contained in:
Dean Herbert 2018-05-14 20:54:51 +09:00 committed by GitHub
commit a5caad1eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View File

@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Catch.Tests namespace osu.Game.Rulesets.Catch.Tests
{ {
public class CatchBeatmapConversionTest : BeatmapConversionTest<TestCatchRuleset, ConvertValue> internal class CatchBeatmapConversionTest : BeatmapConversionTest<TestCatchRuleset, ConvertValue>
{ {
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Tests
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap); protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap);
} }
public struct ConvertValue : IEquatable<ConvertValue> internal struct ConvertValue : IEquatable<ConvertValue>
{ {
/// <summary> /// <summary>
/// A sane value to account for osu!stable using ints everwhere. /// A sane value to account for osu!stable using ints everwhere.
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Tests
&& Precision.AlmostEquals(Position, other.Position, conversion_lenience); && Precision.AlmostEquals(Position, other.Position, conversion_lenience);
} }
public class TestCatchRuleset : CatchRuleset internal class TestCatchRuleset : CatchRuleset
{ {
} }
} }

View File

@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Mania.Tests namespace osu.Game.Rulesets.Mania.Tests
{ {
public class ManiaBeatmapConversionTest : BeatmapConversionTest<TestManiaRuleset, ConvertValue> internal class ManiaBeatmapConversionTest : BeatmapConversionTest<TestManiaRuleset, ConvertValue>
{ {
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Tests
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap); protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap);
} }
public struct ConvertValue : IEquatable<ConvertValue> internal struct ConvertValue : IEquatable<ConvertValue>
{ {
/// <summary> /// <summary>
/// A sane value to account for osu!stable using ints everwhere. /// A sane value to account for osu!stable using ints everwhere.
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Tests
&& Column == other.Column; && Column == other.Column;
} }
public class TestManiaRuleset : ManiaRuleset internal class TestManiaRuleset : ManiaRuleset
{ {
} }
} }

View File

@ -15,7 +15,7 @@ using OpenTK;
namespace osu.Game.Rulesets.Osu.Tests namespace osu.Game.Rulesets.Osu.Tests
{ {
public class OsuBeatmapConversionTest : BeatmapConversionTest<TestOsuRuleset, ConvertValue> internal class OsuBeatmapConversionTest : BeatmapConversionTest<TestOsuRuleset, ConvertValue>
{ {
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Tests
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap); protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap);
} }
public struct ConvertValue : IEquatable<ConvertValue> internal struct ConvertValue : IEquatable<ConvertValue>
{ {
/// <summary> /// <summary>
/// A sane value to account for osu!stable using ints everwhere. /// A sane value to account for osu!stable using ints everwhere.
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Tests
&& Precision.AlmostEquals(EndY, other.EndY, conversion_lenience); && Precision.AlmostEquals(EndY, other.EndY, conversion_lenience);
} }
public class TestOsuRuleset : OsuRuleset internal class TestOsuRuleset : OsuRuleset
{ {
} }
} }

View File

@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Taiko.Tests namespace osu.Game.Rulesets.Taiko.Tests
{ {
public class TaikoBeatmapConversionTest : BeatmapConversionTest<TestTaikoRuleset, ConvertValue> internal class TaikoBeatmapConversionTest : BeatmapConversionTest<TestTaikoRuleset, ConvertValue>
{ {
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap); protected override IBeatmapConverter CreateConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap);
} }
public struct ConvertValue : IEquatable<ConvertValue> internal struct ConvertValue : IEquatable<ConvertValue>
{ {
/// <summary> /// <summary>
/// A sane value to account for osu!stable using ints everwhere. /// A sane value to account for osu!stable using ints everwhere.
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
&& IsStrong == other.IsStrong; && IsStrong == other.IsStrong;
} }
public class TestTaikoRuleset : TaikoRuleset internal class TestTaikoRuleset : TaikoRuleset
{ {
} }
} }

View File

@ -112,7 +112,7 @@ namespace osu.Game.Rulesets
try try
{ {
var assembly = Assembly.LoadFrom(file); var assembly = Assembly.LoadFrom(file);
loaded_assemblies[assembly] = assembly.GetTypes().First(t => t.IsSubclassOf(typeof(Ruleset))); loaded_assemblies[assembly] = assembly.GetTypes().First(t => t.IsPublic && t.IsSubclassOf(typeof(Ruleset)));
} }
catch (Exception) catch (Exception)
{ {