예제 #1
0
        public void UActionMessageGetMessageReturnsLastSetMessage()
        {
            IKarassMessage karassMessage = new KarassMessage();

            karassMessage.SetMessage("Cat");
            Assert.True(karassMessage.Message == "Cat");

            karassMessage.SetMessage("Dog");
            Assert.True(karassMessage.Message == "Dog");
        }
예제 #2
0
        public void MessageSendToMultipleKanKan(string message)
        {
            IKarassMessage karassMessage         = new KarassMessage();
            string         karassOneFrameMessage = string.Empty;

            bool KarassOneFrameSpy(string m)
            {
                karassOneFrameMessage = m;
                return(true);
            }

            FrameRequest karassOneFrameRequest = _mockFramesFactory.GetValidFrameRequest(KarassOneFrameSpy);

            string karassTwoFrameMessage = string.Empty;

            bool KarassTwoFrameSpy(string m)
            {
                karassTwoFrameMessage = m;
                return(true);
            }

            FrameRequest karassTwoFrameRequest = _mockFramesFactory.GetValidFrameRequest(KarassTwoFrameSpy);


            string karassThreeFrameMessage = string.Empty;

            bool KarassThreeFrameSpy(string m)
            {
                karassThreeFrameMessage = m;
                return(true);
            }

            FrameRequest karassThreeFrameRequest = _mockFramesFactory.GetValidFrameRequest(KarassThreeFrameSpy);


            KarassFactory karassFactory = new KarassFactory();

            Karass karassOne   = karassFactory.Get(new List <Action>(), new List <Action>(), new [] { karassOneFrameRequest });
            Karass karassTwo   = karassFactory.Get(new List <Action>(), new List <Action>(), new [] { karassTwoFrameRequest });
            Karass karassThree = karassFactory.Get(new List <Action>(), new List <Action>(), new [] { karassThreeFrameRequest });

            KanKanCore.KanKan kanKanOne   = new KanKanCore.KanKan(karassOne, _frameFactory, karassMessage);
            KanKanCore.KanKan kanKanTwo   = new KanKanCore.KanKan(karassTwo, _frameFactory, karassMessage);
            KanKanCore.KanKan kanKanThree = new KanKanCore.KanKan(karassThree, _frameFactory, karassMessage);

            karassMessage.SetMessage(message);

            kanKanOne.MoveNext();
            kanKanTwo.MoveNext();
            kanKanThree.MoveNext();

            Assert.True(karassOneFrameMessage == message);
            Assert.True(karassTwoFrameMessage == message);
            Assert.True(karassThreeFrameMessage == message);
        }
예제 #3
0
        public void UActionMessageClearMessageSetsMessageToStringEmpty()
        {
            IKarassMessage karassMessage = new KarassMessage();

            karassMessage.SetMessage("Dog");
            karassMessage.ClearMessage();
            Assert.True(karassMessage.Message == string.Empty);

            karassMessage.SetMessage("Cat");
            karassMessage.ClearMessage();
            Assert.True(karassMessage.Message == string.Empty);
        }