예제 #1
0
        public async Task Should_Return__Exception_When_BillingUserIsNotAvailable()
        {
            var paymentManagement = new PaymentManagement(_unitOfWorkMock.Object, _emailSender.Object, _webHostEnvironment.Object);

            _unitOfWorkMock.Setup(m => m.PaymentRepository).Returns(_paymentRepositoryMock.Object);
            await Assert.ThrowsAsync <ArgumentNullException>(async() => await paymentManagement.GetBillingUser(1).ConfigureAwait(false));
        }
예제 #2
0
        public async Task ShouldRetrieveBillingUser()
        {
            UserForRegisterDto userDto;

            {
                userDto = new UserForRegisterDto()
                {
                    FirstName = "Nemo",
                    LastName  = "Memo"
                };
            }

            _paymentRepositoryMock.Setup(x => x.GetBillingUser(1)).ReturnsAsync(userDto);
            _unitOfWorkMock.Setup(m => m.PaymentRepository).Returns(_paymentRepositoryMock.Object);

            var paymentManagement          = new PaymentManagement(_unitOfWorkMock.Object, _emailSender.Object, _webHostEnvironment.Object);
            UserForRegisterDto billingUser = await paymentManagement.GetBillingUser(1).ConfigureAwait(false);

            Assert.NotNull(billingUser);
            Assert.IsAssignableFrom <UserForRegisterDto>(billingUser);
            Assert.Equal("Nemo", billingUser.FirstName);
        }