public async Task TestAllPayloadAndReturnItemPost()
        {
            var controller = new ChallengeController();
            // Arrange
            string  json  = File.ReadAllText("InputJson/sample_request.json");
            Payload input = JsonConvert.DeserializeObject <Payload>(json);



            // Act
            ActionResult <Response> actionResult = await controller.Post(input);

            // Assert
            Assert.IsType <ActionResult <Response> >(actionResult);
        }
Exemplo n.º 2
0
        public void Should_Be_Ok_When_Post()
        {
            var fakes       = new Fakes();
            var fakeService = fakes.FakeChallengeService().Object;
            var expected    = fakes.Get <ChallengeDTO>().First();

            expected.Id = 0;

            var controller = new ChallengeController(fakeService, fakes.Mapper);
            var result     = controller.Post(expected);

            Assert.IsType <OkObjectResult>(result.Result);
            var actual = (result.Result as OkObjectResult).Value as ChallengeDTO;

            Assert.NotNull(actual);
            Assert.Equal(999, actual.Id);
            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Slug, actual.Slug);
        }