Beispiel #1
0
        public void CalculateFrequencyTest()
        {
            var view = new Mock <IMainGameView>();

            var controller = new MainGameController(view.Object);

            controller.LoadKeysResources(TestKeyFileResource);

            view.Setup(x => x.PlaySound(It.Is <int>(f => f == 110), 100));
            controller.ProcessKey(Keys.Q); //key#0
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is <int>(f => f == 117), 100));
            controller.ProcessKey(Keys.W); //key#0
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is <int>(f => f == 175), 100));
            controller.ProcessKey(Keys.O); //key#8
            view.VerifyAll();

            view.Reset();
            view.Setup(x => x.PlaySound(It.Is <int>(f => f == 185), 100));
            controller.ProcessKey(Keys.P); //key#9
            view.VerifyAll();
        }
Beispiel #2
0
        public void LoadKeysEmptyFileTest()
        {
            var view       = new Mock <IMainGameView>();
            var controller = new MainGameController(view.Object);

            controller.LoadKeysResources("");

            controller.Chars.Count.ShouldBe(0);
        }
Beispiel #3
0
        public void ProcessKeyTest()
        {
            var view = new Mock <IMainGameView>();

            view.Setup(x => x.PlaySound(It.IsAny <int>(), 100));

            var controller = new MainGameController(view.Object);

            controller.LoadKeysResources(TestKeyFileResource);

            controller.ProcessKey(Keys.R);
            view.VerifyAll();
        }
Beispiel #4
0
        public void LoadKeysFileTest()
        {
            var view       = new Mock <IMainGameView>();
            var controller = new MainGameController(view.Object);

            controller.LoadKeysResources(TestKeyFileResource);

            controller.Chars.Count.ShouldBe(10);
            var test = controller.Chars[Keys.Q];

            test.Color.ShouldBe(Color.FromKnownColor(KnownColor.DarkCyan));
            test.Character.ShouldBe('Й');
            test = controller.Chars[Keys.P];
            test.Color.ShouldBe(Color.FromKnownColor(KnownColor.DarkRed));
            test.Character.ShouldBe('З');
        }