예제 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiBadgeModelMapper();
            var model  = new ApiBadgeResponseModel();

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

            response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
            response.UserId.Should().Be(1);
        }
예제 #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());

            ApiBadgeResponseModel model = await client.BadgeGetAsync(1);

            ApiBadgeModelMapper mapper = new ApiBadgeModelMapper();

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

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