Esempio n. 1
0
        public void TestSingDemoSong()
        {
            var beatmap = new KaraokeBeatmap();

            var data      = TestResources.OpenTrackResource("demo");
            var generated = new KaraokeAutoGeneratorBySinger(beatmap, data).Generate();

            // Get generated frame and compare frame
            var karaokeFrames = generated.Frames.OfType <KaraokeReplayFrame>().ToList();
            var compareFrame  = getCompareResultFromName("demo");

            // Check total frames.
            Assert.AreEqual(karaokeFrames.Count, compareFrame.Count, $"Replay frame should have {compareFrame.Count}.");

            // Compare generated frame with result;
            for (int i = 0; i < compareFrame.Count; i++)
            {
                Assert.AreEqual(karaokeFrames[i].Time, compareFrame[i].Time);
                Assert.AreEqual(karaokeFrames[i].Sound, compareFrame[i].Sound);

                if (!compareFrame[i].Sound)
                {
                    continue;
                }

                var convertedScale = beatmap.PitchToScale(compareFrame[i].Pitch);
                Assert.AreEqual(karaokeFrames[i].Scale, convertedScale);
            }
        }