public void CreationFromData() { var input = IntervalGeneration.Sequence(0, 5, 5, 10, MakeDummy).ToArray(); var sut = _factory.Create(input); CollectionAssert.AreEqual(sut, input); }
public void CountReflectsReality() { var input = IntervalGeneration.Sequence(0, 10, 5, 5, MakeDummy).ToArray(); AddIntervals(input); var expectedOutput = IntervalGeneration.Sequence(0, 5, 5, input.Length - 1, i => input[i].Payload).Concat(input.Skip(input.Length - 1)); Assert.That(_sut.Count, Is.EqualTo(expectedOutput.Count())); }
public void NonOverwritingUpdate() { var input = IntervalGeneration.DashedSequence(0, 2, 10, MakeDummy).ToArray(); _sut.Put(input); var output = _sut.ToArray(); CollectionAssert.AreEqual(input, output); }
public void OverwritingUpdate() { var input = IntervalGeneration.Sequence(0, 10, 5, 5, MakeDummy).ToArray(); AddIntervals(input); var output = _sut.ToArray(); var expectedOutput = IntervalGeneration.Sequence(0, 5, 5, input.Length - 1, i => input[i].Payload).Concat(input.Skip(input.Length - 1)); CollectionAssert.AreEqual(expectedOutput, output); }
public void TouchingUpdate() { const int count = 5; const int duration = 5; const int step = 5; var input = IntervalGeneration.Sequence(0, duration, step, count, MakeDummy).ToArray(); _sut.Put(input); CollectionAssert.AreEqual(_sut, input); }
public void OverwritingUpdate() { var input = IntervalGeneration.Sequence(0, 10, 5, 5, MakeDummy).ToArray(); var space = new MappedInterval <Crate> [1]; foreach (var i in input) { space[0] = i; _sut.Put(space); } var output = _sut.ToArray(); var expectedOutput = IntervalGeneration.Sequence(0, 5, 5, input.Length - 1, i => input[i].Payload).Concat(input.Skip(input.Length - 1)); CollectionAssert.AreEqual(expectedOutput, output); }
public void EnumerationFrom(int intervalsToSkip, int margin) { const int count = 10; const int duration = 5; const int step = 5; var input = IntervalGeneration.Sequence(0, duration, step, count, MakeDummy).ToArray(); _sut.Put(input); var from = (duration + step) * intervalsToSkip + margin; var later = input.Where(i => i.IntervalEnd >= from).ToArray(); var part = CollectFrom(_sut, from).ToArray(); Assert.That(part.Length, Is.EqualTo(later.Length)); CollectionAssert.AreEqual(part, later); }