Пример #1
0
        public async Task GetEmployeePresenceStatus_NoData_Test()
        {
            var(service, logger, mockFactory, mockHttpMessageHandler, config, sqlApi) = getService(ResponseContents.GetEmployeePresenceStatusErrorNoDataResponse());

            var ex = await Assert.ThrowsAsync <ArgumentException>(async() => await service.GetEmployeePresenceStatus(1, 1234));

            mockHttpMessageHandler.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req => req.CheckRequest(config.Endpoint, RequestContents.GetEmployeePresenceStatusRequestContent(1, 1234))),
                ItExpr.IsAny <CancellationToken>());
        }
Пример #2
0
        public async Task GetEmployeePresenceStatusTest()
        {
            //Arrange
            var(service, logger, mockFactory, mockHttpMessageHandler, config, sqlApi) = getService(ResponseContents.GetEmployeePresenceStatusResponse());

            var status = await service.GetEmployeePresenceStatus(1, 5555);

            status.Should().BeOfType <EmployeePresenceStatus>();
            status.EmployeeId.Should().Be(5555);
            status.CurrentDate.Should().Be(new DateTime(2020, 11, 11));
            status.Type.Should().Be(PresenceType.AB);

            mockHttpMessageHandler.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req => req.CheckRequest(config.Endpoint, RequestContents.GetEmployeePresenceStatusRequestContent(1, 5555))),
                ItExpr.IsAny <CancellationToken>());
        }