public async Task GetEmployeeList_Error_Wrong_Company_Test() { //Arrange var(service, logger, mockFactory, mockHttpMessageHandler, config, sqlApi) = getService(ResponseContents.GetEmployeeListErrorCompanyResponse()); var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await service.GetEmployeeList(789)); mockHttpMessageHandler.Protected().Verify( "SendAsync", Times.Exactly(1), ItExpr.Is <HttpRequestMessage>(req => req.CheckRequest(config.Endpoint, RequestContents.GetEmployeeListRequestContent(789))), ItExpr.IsAny <CancellationToken>()); }
public async Task GetEmployeeListTest() { //Arrange var(service, logger, mockFactory, mockHttpMessageHandler, config, sqlApi) = getService(ResponseContents.GetEmployeeListResponse()); var list = await service.GetEmployeeList(1); list.Should().BeOfType <List <EmployeeBaseInfo> >(); list.Count.Should().Be(4); list.First().FirstName.Should().Be("Martin"); list.First().LastName.Should().Be("Auer"); list.First().EmployeeId.Should().Be(5120); list.Last().FirstName.Should().Be("Manfred"); list.Last().LastName.Should().Be("Augustin"); list.Last().EmployeeId.Should().Be(1425); mockHttpMessageHandler.Protected().Verify( "SendAsync", Times.Exactly(1), ItExpr.Is <HttpRequestMessage>(req => req.CheckRequest(config.Endpoint, RequestContents.GetEmployeeListRequestContent(1))), ItExpr.IsAny <CancellationToken>()); }