Example #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiVoteModelMapper();
            var model  = new ApiVoteResponseModel();

            model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, 1);
            ApiVoteRequestModel response = mapper.MapResponseToRequest(model);

            response.BountyAmount.Should().Be(1);
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PostId.Should().Be(1);
            response.UserId.Should().Be(1);
            response.VoteTypeId.Should().Be(1);
        }
Example #2
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiVoteResponseModel model = await client.VoteGetAsync(1);

            ApiVoteModelMapper mapper = new ApiVoteModelMapper();

            UpdateResponse <ApiVoteResponseModel> updateResponse = await client.VoteUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }