public async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); var createModel = new ApiBadgeRequestModel(); createModel.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 2); CreateResponse <ApiBadgeResponseModel> createResult = await client.BadgeCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiBadgeResponseModel getResponse = await client.BadgeGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.BadgeDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiBadgeResponseModel verifyResponse = await client.BadgeGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiBadgeResponseModel> CreateRecord(ApiClient client) { var model = new ApiBadgeRequestModel(); model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 2); CreateResponse <ApiBadgeResponseModel> result = await client.BadgeCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLBadgeMapper(); ApiBadgeRequestModel model = new ApiBadgeRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1); BOBadge response = mapper.MapModelToBO(1, model); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.UserId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiBadgeModelMapper(); var model = new ApiBadgeRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1); JsonPatchDocument <ApiBadgeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiBadgeRequestModel(); patch.ApplyTo(response); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.UserId.Should().Be(1); }