Beispiel #1
0
                public void ThenNewMessageIDIsGUID()
                {
                    GenerateSeedStub   stub = new GenerateSeedStub(0);
                    PublishEndPointSpy publishEndPointSpy = new PublishEndPointSpy();

                    new GetStartingCard(new PackVersionGatewayDummy(), new AwaitingResponseGatewayDummy(), stub, publishEndPointSpy).Execute("SessionID");
                    Assert.True(publishEndPointSpy.MessageObject is IRequestStartingCard);
                    IRequestStartingCard newGameData = (IRequestStartingCard)publishEndPointSpy.MessageObject;

                    Assert.True(Guid.TryParse(newGameData.MessageID, out Guid _));
                }
Beispiel #2
0
                public void ThenValueIsSavedToCreateGameGateway(int version)
                {
                    PackVersionGatewayStub stub = new PackVersionGatewayStub(version);
                    PublishEndPointSpy     publishEndPointSpy = new PublishEndPointSpy();

                    new GetStartingCard(stub, new AwaitingResponseGatewayDummy(), new GenerateSeedDummy(), publishEndPointSpy).Execute("SessionID");
                    Assert.True(publishEndPointSpy.MessageObject is IRequestStartingCard);
                    IRequestStartingCard newGameData = (IRequestStartingCard)publishEndPointSpy.MessageObject;

                    Assert.True(newGameData.PackVersionNumber == version);
                }
Beispiel #3
0
                public void ThenValueIsSavedToCreateGameGateway(int seedGeneratorReturnValue)
                {
                    GenerateSeedStub   stub = new GenerateSeedStub(seedGeneratorReturnValue);
                    PublishEndPointSpy publishEndPointSpy = new PublishEndPointSpy();

                    new GetStartingCard(new PackVersionGatewayDummy(), new AwaitingResponseGatewayDummy(), stub, publishEndPointSpy).Execute("SessionID");
                    Assert.True(publishEndPointSpy.MessageObject is IRequestStartingCard);
                    IRequestStartingCard newGameData = (IRequestStartingCard)publishEndPointSpy.MessageObject;

                    Assert.True(Math.Abs(newGameData.Seed - seedGeneratorReturnValue) < 0.1f);
                }
Beispiel #4
0
                public void ThenValueIsSavedToCreateGameGateway(string sessionID)
                {
                    PublishEndPointSpy publishEndPointSpy = new PublishEndPointSpy();

                    new GetStartingCard(new PackVersionGatewayDummy(), new AwaitingResponseGatewayDummy(), new GenerateSeedDummy(),
                                        publishEndPointSpy).Execute(sessionID);
                    Assert.True(publishEndPointSpy.MessageObject is IRequestStartingCard);
                    IRequestStartingCard newGameData = (IRequestStartingCard)publishEndPointSpy.MessageObject;

                    Assert.True(newGameData.SessionID == sessionID);
                }
Beispiel #5
0
                public void ThenNewMessageIdIsAddedToAwaitingResponseGateway()
                {
                    GenerateSeedStub           stub = new GenerateSeedStub(0);
                    PublishEndPointSpy         publishEndPointSpy = new PublishEndPointSpy();
                    AwaitingResponseGatewaySpy spy = new AwaitingResponseGatewaySpy(true);

                    new GetStartingCard(new PackVersionGatewayDummy(), spy, stub, publishEndPointSpy).Execute("SessionID");
                    Assert.True(publishEndPointSpy.MessageObject is IRequestStartingCard);
                    IRequestStartingCard newGameData = (IRequestStartingCard)publishEndPointSpy.MessageObject;

                    Assert.True(spy.SaveIDInput == newGameData.MessageID);
                }