public virtual async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; IPipelineService service = testServer.Host.Services.GetService(typeof(IPipelineService)) as IPipelineService; var model = new ApiPipelineServerRequestModel(); model.SetProperties(1, 2); CreateResponse <ApiPipelineServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.PipelineDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiPipelineServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public void MapServerRequestToResponse() { var mapper = new ApiPipelineServerModelMapper(); var model = new ApiPipelineServerRequestModel(); model.SetProperties(1, 1); ApiPipelineServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.PipelineStatusId.Should().Be(1); response.SaleId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiPipelineServerModelMapper(); var model = new ApiPipelineServerRequestModel(); model.SetProperties(1, 1); JsonPatchDocument <ApiPipelineServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPipelineServerRequestModel(); patch.ApplyTo(response); response.PipelineStatusId.Should().Be(1); response.SaleId.Should().Be(1); }