Example #1
0
        public async Task Should_have_correct_status()
        {
            var context = DbContextFactory.CreateTripleTriadContext();
            var command = new GameCreate.Request()
            {
                PlayerId = this.playerId
            };
            var subject = new GameCreate.RequestHandler(context);

            var response = await subject.Handle(command, default);

            var game = await context.Games.SingleAsync(x => x.GameId == response.GameId);

            game.Status.Should().Be(GameStatus.Waiting);
        }
Example #2
0
        public async Task Should_return_created_game()
        {
            var context = DbContextFactory.CreateTripleTriadContext();
            var command = new GameCreate.Request()
            {
                PlayerId = this.playerId
            };
            var subject = new GameCreate.RequestHandler(context);

            var response = await subject.Handle(command, default);

            Func <Task <Game> > act = async() => await context.Games.SingleAsync(x => x.GameId == response.GameId);

            act.Should().NotThrow();
        }
Example #3
0
        public async Task Should_have_correct_new_game_data()
        {
            var context = DbContextFactory.CreateTripleTriadContext();
            var command = new GameCreate.Request()
            {
                PlayerId = this.playerId
            };
            var subject = new GameCreate.RequestHandler(context);

            var response = await subject.Handle(command, default);

            var game = await context.Games.SingleAsync(x => x.GameId == response.GameId);

            var expectedGameData = "{'Log':[],'Rules':[]}";

            JToken.DeepEquals(JObject.Parse(game.Data), JObject.Parse(expectedGameData))
            .Should()
            .BeTrue();
        }