Пример #1
0
        public DonationControllerTest(DonationFixture donationFix, AddressFixture addressFix, CreditCardFixture creditFix)
        {
            credFix = creditFix;
            donFix  = donationFix;
            addFix  = addressFix;

            appConfig           = new Mock <GloballAppConfig>();
            donationRepository  = new Mock <IDoacaoRepository>();
            notificationService = new DomainNotificationService();
            toastNotification   = new Mock <IToastNotification>();
            polenService        = new Mock <IPaymentService>();
            logger = new Mock <ILogger <DoacoesController> >();
            mapper = new Mock <IMapper>();

            validDonation = donFix.Valid();
            validDonation.AdicionarFormaPagamento(credFix.Valid());
            validDonation.AdicionarEnderecoCobranca(addFix.Valid());

            validDonationVM = donFix.ValidVM();
            validDonationVM.EnderecoCobranca = addressFix.ValidVM();
            validDonationVM.FormaPagamento   = credFix.ValidVM();

            mapper.Setup(a => a.Map <DoacaoViewModel, Doacao>(validDonationVM)).Returns(validDonation);
            donationService = new DoacaoService(mapper.Object, donationRepository.Object, notificationService);
        }
Пример #2
0
        public DonationTests(DonationFixture donationFix, AddressFixture addressFix, CreditCardFixture creditFix)
        {
            driverFactory = new DriverFactory();

            credFix = creditFix;
            donFix  = donationFix;
            addFix  = addressFix;
        }
Пример #3
0
        public async Task SaveShouldAddANewAddressGiverNonExistingEntry()
        {
            using var scope = ServiceProvider.CreateScope();
            var sut        = scope.ServiceProvider.GetRequiredService <IAddressRepository>();
            var unitOfWork = scope.ServiceProvider.GetRequiredService <IUnitOfWork>();
            var context    = scope.ServiceProvider.GetRequiredService <ApplicationContext>();

            var address = AddressFixture.GetDummyAddress();
            await sut.SaveAsync(address);

            var savedChanges = await unitOfWork.SaveChangesAsync();

            var savedAddress = await context.Addresses.FirstAsync();

            Assert.True(savedChanges);
            AssertDummyAddress(savedAddress);
            Assert.NotEqual(default, savedAddress.Uuid);
        public async Task SaveShouldAddANewAddressGivenNonExistingEntry()
        {
            using var scope = ServiceProvider.CreateScope();
            var sut        = scope.ServiceProvider.GetRequiredService <IAddressService>();
            var unitOfWork = scope.ServiceProvider.GetRequiredService <IUnitOfWork>();
            var context    = scope.ServiceProvider.GetRequiredService <ApplicationContext>();

            var address = AddressFixture.GetDummyAddress();

            var result = await sut.SaveAsync(address);

            await unitOfWork.SaveChangesAsync();

            Assert.True(result.IsSuccessful);
            Assert.NotEmpty(context.Addresses);
            Assert.Equal(1, context.Addresses.Count());
        }
 public AddressControllerTests(AddressFixture addressFixture)
 {
     _addressFixture = addressFixture;
 }
Пример #6
0
 public DonationTests(DonationFixture donFix, AddressFixture addFix, CreditCardFixture caFix)
 {
     donationFix = donFix;
     addressFix  = addFix;
     cardFix     = caFix;
 }