Exemplo n.º 1
0
        public async Task GivenAlreadyImportedLeagueCodeShouldReturnConflict()
        {
            var controller = new FootballController(MockComponentsProvider(GetInMemoryDbContext()));

            await controller.Import("BL1");

            var result = await controller.Import("BL1");

            var objectResult = result as ConflictObjectResult;

            Assert.NotNull(objectResult);

            var value = objectResult.Value.ToString();

            Assert.True(value == "{ Message = League already imported }");
        }
Exemplo n.º 2
0
        public async Task GivenInvalidLeagueCodeImportShouldReturn404()
        {
            var controller = new FootballController(MockComponentsProvider(GetInMemoryDbContext()));

            var result = await controller.Import(Guid.NewGuid().ToString());

            var objectResult = result as NotFoundObjectResult;

            Assert.NotNull(objectResult);

            var value = objectResult.Value.ToString();

            Assert.True(value == "{ Message = Not found }");
        }
Exemplo n.º 3
0
        public async Task GivenValidLeagueCodeImportShouldStoreData()
        {
            var controller = new FootballController(MockComponentsProvider(GetInMemoryDbContext()));

            var result = await controller.Import("BL1");

            var objectResult = result as ObjectResult;

            Assert.NotNull(objectResult);

            Assert.True(objectResult.StatusCode == 201);

            var value = objectResult.Value.ToString();

            Assert.True(value == "{ Message = Successfully imported }");
        }
        public async Task GivenValidLeagueCodeShouldReturnPlayerCount()
        {
            var componentsProvider = MockComponentsProvider(GetInMemoryDbContext());
            var footballController = new FootballController(componentsProvider);
            var playerController   = new PlayerController(componentsProvider);

            await footballController.Import("BL1");

            var result = await playerController.TotalPlayers("BL1");

            var objectResult = result as OkObjectResult;

            Assert.NotNull(objectResult);
            var value = objectResult.Value.ToString();

            Assert.True(value == "{ total = 1184 }");
        }