public void SetUp()
        {
            //Arrange
            _container = new AutoMocker();

            _container.Use(ViewModelMapperFactory.Create());
            _container.Use(CartRepositoryFactory.Create());
            _container.Use(CartViewModelFactoryMock.Create());
            _container.Use(CountryServiceMock.Create());
            _container.Use(LocalizationProviderFactory.Create());
        }
예제 #2
0
        public void SetUp()
        {
            //Arrange
            _container = new AutoMocker();

            _container.Use(ViewModelMapperFactory.Create());
            _container.Use(CartRepositoryFactory.Create());
            _container.Use(CartViewModelFactoryMock.Create());
            _container.Use(CountryServiceMock.Create());
            _container.Use <IFixCartService>(new FakeFixCartService());

            var localizationProviderMock = new Mock <ILocalizationProvider>();

            localizationProviderMock
            .Setup(c => c.GetLocalizedString(It.IsAny <GetLocalizedParam>()))
            .Returns("{0}");
        }
예제 #3
0
        public void WHEN_postal_code_does_not_matches_regex_SHOULD_result_not_be_null()
        {
            // Arrange
            _container.Use(CountryServiceMock.Create(CanadianPostalCodeRegex));

            var service = _container.CreateInstance <CartService>();

            // Act and Assert
            Assert.ThrowsAsync <InvalidOperationException>(() => service.UpdateShippingAddressPostalCodeAsync(new UpdateShippingAddressPostalCodeParam
            {
                CultureInfo = TestingExtensions.GetRandomCulture(),
                CustomerId  = Guid.NewGuid(),
                CartName    = GetRandom.String(32),
                BaseUrl     = GetRandom.String(32),
                Scope       = GetRandom.String(32),
                PostalCode  = "any",
                CountryCode = GetRandom.String(1)
            }));
        }
예제 #4
0
        public async Task WHEN_postal_code_matches_regex_SHOULD_result_not_be_null()
        {
            // Arrange
            _container.Use(CountryServiceMock.Create(CanadianPostalCodeRegex));

            var service = _container.CreateInstance <CartService>();

            // Act
            var result = await service.UpdateBillingAddressPostalCodeAsync(new UpdateBillingAddressPostalCodeParam
            {
                CultureInfo = TestingExtensions.GetRandomCulture(),
                CustomerId  = Guid.NewGuid(),
                CartName    = GetRandom.String(32),
                BaseUrl     = GetRandom.String(32),
                Scope       = GetRandom.String(32),
                PostalCode  = "J5R 5Y5",
                CountryCode = GetRandom.String(1)
            });

            // Assert
            result.Should().NotBeNull();
        }