Beispiel #1
0
        public async Task ThenAgreementsAreReturned()
        {
            var request = new GetAgreementEventsRequestBuilder().Build();

            var expectedAgreements = new List <AgreementEvent>();

            Repository.Setup(r => r.GetByRange(request.FromDateTime, request.ToDateTime, request.PageSize, request.PageNumber, request.FromEventId)).ReturnsAsync(expectedAgreements);

            var response = await Handler.Handle(request);

            response.Data.Should().BeSameAs(expectedAgreements);
        }
Beispiel #2
0
        public void AndTheEventIdIsLessThanZeroThenValidationFails()
        {
            var request = new GetAgreementEventsRequestBuilder().WithEventId(-1).Build();

            Assert.ThrowsAsync <ValidationException>(() => Handler.Handle(request));
        }
Beispiel #3
0
        public void AndThePageNumberIsGreaterThanTenThousandThenValidationFails()
        {
            var request = new GetAgreementEventsRequestBuilder().WithPageSize(10001).Build();

            Assert.ThrowsAsync <ValidationException>(() => Handler.Handle(request));
        }
Beispiel #4
0
        public void AndThePageSizeIsLessThanOneThenValidationFails()
        {
            var request = new GetAgreementEventsRequestBuilder().WithPageSize(0).Build();

            Assert.ThrowsAsync <ValidationException>(() => Handler.Handle(request));
        }
Beispiel #5
0
        public void AndTheFromDateIsAfterTheToDateThenValidationFails()
        {
            var request = new GetAgreementEventsRequestBuilder().WithFromDate(DateTime.Now.AddDays(-1)).WithToDate(DateTime.Now.AddDays(-2)).Build();

            Assert.ThrowsAsync <ValidationException>(() => Handler.Handle(request));
        }