Beispiel #1
0
        public void MultipleDifferentSamplesCanBeAddedAtPosition()
        {
            var firstSample = new Sample("*");
            var secondSample = new Sample("=");
            var score = new Score();

            score.AddSample(firstSample);
            score.AddSample(secondSample);

            Assert.IsTrue(score.Samples[0].Contains(firstSample));
            Assert.IsTrue(score.Samples.First().Value.Contains(secondSample));
        }
Beispiel #2
0
        public void IdenticalSampleIsNotDuplicated()
        {
            const string key = "*";
            var sample = new Sample(key);
            var identicalSample = new Sample(key);
            var score = new Score();

            score.AddSample(sample);
            score.AddSample(identicalSample);

            Assert.That(score.Samples[0].Count(s => s.Type == key), Is.EqualTo(1));
        }
Beispiel #3
0
        public void ProgressAfterSetPositionMovesToNextBeat(int adjustment, int expectedNextPosition, int expectedLastPosition)
        {
            var dummySample = new Sample("=");
            var expectedSample = new Sample("=");
            var score = new Score();

            score.Progress(); // position will now be eight
            score.SetPosition(adjustment);
            score.AddSample(dummySample);
            score.Progress();
            score.AddSample(expectedSample);
            score.Progress();
            score.AddSample(expectedSample);

            Assert.That(score.Samples[expectedNextPosition].Contains(expectedSample));
            Assert.That(score.Samples[expectedLastPosition].Contains(expectedSample));
        }
Beispiel #4
0
        public void AddSampleAddsSampleAtCurrentPosition()
        {
            var sample = new Sample("*");
            var score = new Score();

            score.AddSample(sample);

            Assert.That(score.Samples[0].Single(), Is.EqualTo(sample));
        }
Beispiel #5
0
        public void EarlyOffsetBeatAtStartOfScoreIsAtPositionZero()
        {
            var expected = new Sample("1");
            var score = new Score();

            score.SetPosition(-1);
            score.AddSample(expected);

            Assert.That(score.Samples[0], Contains.Item(expected));
        }
Beispiel #6
0
        public void SamplesAreAddedEightFramesApartAfterProgression()
        {
            var firstSample = new Sample("*");
            var secondSample = new Sample("=");
            var score = new Score();

            score.AddSample(firstSample);
            score.Progress();
            score.AddSample(secondSample);

            Assert.That(score.Samples[0].Contains(firstSample));
            Assert.That(score.Samples[8].Contains(secondSample));
        }
Beispiel #7
0
        public void SetPositionAllowsSamplesToBeAddedBeforeAndAfterTheBeat(int adjustment)
        {
            var sample = new Sample("*");
            var score = new Score();

            score.Progress(); // position will now be eight
            score.SetPosition(adjustment);
            score.AddSample(sample);

            const int initialPosition = 8;
            Assert.That(score.Samples[initialPosition + adjustment].Contains(sample));
        }