forked from Jarno458/TsRandomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandomizerFixture.cs
36 lines (30 loc) · 901 Bytes
/
RandomizerFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Linq;
using NUnit.Framework;
using TsRandomizer.Randomisation;
namespace TsRandomizer.Tests
{
[TestFixture]
class RandomizerFixture
{
[Test]
public void Should_generate_single_beatable_seed()
{
var result = Randomizer.Generate(FillingMethod.Random, SeedOptions.None);
Assert.That(Randomizer.IsBeatable(result.Seed, FillingMethod.Random), Is.True);
}
[Test]
public void Should_generate_a_hundert_beatable_seeds()
{
var seeds = new LookupDictionairy<Seed, GenerationResult>(r => r.Seed);
while (seeds.Count != 100)
{
var result = Randomizer.Generate(FillingMethod.Random, SeedOptions.None);
if(!seeds.Contains(result.Seed))
seeds.Add(result);
}
var longestGeneration = seeds.OrderByDescending(s => s.Elapsed).First();
var validSeeds = string.Join("\n", seeds.Select(s => s.Seed));
Assert.That(seeds, Is.Not.Empty);
}
}
}