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; IVideoService service = testServer.Host.Services.GetService(typeof(IVideoService)) as IVideoService; var model = new ApiVideoServerRequestModel(); model.SetProperties("B", "B", "B"); CreateResponse <ApiVideoServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.VideoDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiVideoServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public void MapServerRequestToResponse() { var mapper = new ApiVideoServerModelMapper(); var model = new ApiVideoServerRequestModel(); model.SetProperties("A", "A", "A"); ApiVideoServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.Description.Should().Be("A"); response.Title.Should().Be("A"); response.Url.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiVideoServerModelMapper(); var model = new ApiVideoServerRequestModel(); model.SetProperties("A", "A", "A"); JsonPatchDocument <ApiVideoServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiVideoServerRequestModel(); patch.ApplyTo(response); response.Description.Should().Be("A"); response.Title.Should().Be("A"); response.Url.Should().Be("A"); }