コード例 #1
0
ファイル: FrameTests.cs プロジェクト: danielburnley/KanKan
        public void ExecuteMethodCorrectlyExecutesFrameRequest(string testMessage, string testActionDataPayload)
        {
            //Arrange
            KarassDependenciesSpy dependenciesSpy = new KarassDependenciesSpy();
            FrameStructDummy      frameActionData = new FrameStructDummy
            {
                Test = testActionDataPayload
            };

            FrameRequest frameRequest = new FrameRequest(frameActionData);
            KarassFrameSpy <FrameStructDummy> frameAction = new KarassFrameSpy <FrameStructDummy>(dependenciesSpy);

            dependenciesSpy.Register <IKarassFrame <FrameStructDummy> >(() => frameAction);
            FrameFactory frameFactory = new FrameFactory(dependenciesSpy);

            frameFactory.RegisterRoute <FrameStructDummy, IKarassFrame <FrameStructDummy> >();

            //Act
            frameFactory.Execute(frameRequest, testMessage);

            //Assert
            Assert.True(dependenciesSpy.RegisterCallCount == 1);
            Assert.True(dependenciesSpy.GetCallCount == 1);
            Assert.True(frameAction.ExecuteCallCount == 1);
            Assert.True(frameAction.RequestData.Test == testActionDataPayload);
            Assert.True(frameAction.Message == testMessage);
            Assert.True(frameAction.Dependencies == dependenciesSpy);
        }
コード例 #2
0
ファイル: FrameTests.cs プロジェクト: danielburnley/KanKan
        public void GetMethodReturnsCorrectData(string testString, string message)
        {
            // Arrange
            KarassDependenciesSpy dependenciesSpy = new KarassDependenciesSpy();
            FrameStructDummy      frameActionData = new FrameStructDummy
            {
                Test = testString
            };
            KarassFrameSpy <FrameStructDummy> frameAction = new KarassFrameSpy <FrameStructDummy>(dependenciesSpy);

            dependenciesSpy.Register <IKarassFrame <FrameStructDummy> >(() => frameAction);
            FrameFactory frameFactory = new FrameFactory(dependenciesSpy);

            frameFactory.RegisterRoute <FrameStructDummy, IKarassFrame <FrameStructDummy> >();

            //Act
            IKarassFrame <FrameStructDummy> frame = frameFactory.Get <FrameStructDummy>();

            frame.Execute(message, frameActionData);


            //Assert
            Assert.True(dependenciesSpy.GetCallCount == 1);
            Assert.True(dependenciesSpy.RegisterCallCount == 1);
            Assert.True(frameAction.ExecuteCallCount == 1);
            Assert.True(frame.Message == message);
            Assert.True(frame.RequestData.Test == testString);
            Assert.AreEqual(frameAction.Dependencies, dependenciesSpy);
        }