public void MapClientResponseToRequest() { var mapper = new ApiFollowingModelMapper(); var model = new ApiFollowingClientResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiFollowingClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Muted.Should().Be("A"); }
public virtual async void TestGetNotFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApiFollowingClientResponseModel response = await client.FollowingGetAsync(default(int)); response.Should().BeNull(); }
public virtual async void TestGetFound() { 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; ApiFollowingClientResponseModel response = await client.FollowingGetAsync(1); response.Should().NotBeNull(); response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Muted.Should().Be("A"); response.UserId.Should().Be(1); }