Esempio n. 1
0
        public void Setup()
        {
            //add currency
            var britishCurrency = new Entities.Currencies.Currency
            {
                Name = "British Pound",
                Code = "GBP",
                Format = "£0.00"
            };
            _currencyService.Add(britishCurrency);

            var taxRate = new TaxRate
            {
                Name = "VAT",
                Code = "S",
                Percentage = 20m
            };
            _taxRateManager.Add(taxRate);

            var uk = new Country
            {
                Name = "United Kingdom",
                ISOTwoLetterCode = "GB"
            };
            _countryService.AddCountry(uk);
        }
Esempio n. 2
0
        public void CountryController_AddPost_ReturnsRedirectToIndex()
        {
            var country = new Country() { Name = "Great Britain", ISOTwoLetterCode = "GB" };

            var result = _countryController.Add_POST(country);

            result.RouteValues["action"].Should().Be("Index");
        }
Esempio n. 3
0
        public void RegionController_Add_ModelShouldHavePassedCountrySet()
        {
            var country = new Country();
            
            var result = _regionController.Add(country);

            result.Model.As<Region>().Country.Should().Be(country);
        }
Esempio n. 4
0
        public void RegionController_Add_ShouldReturnPartialViewResult()
        {
            var country = new Country();
            
            var result = _regionController.Add(country);

            result.Should().BeOfType<PartialViewResult>();
        }
Esempio n. 5
0
        public void RegionController_Add_ShouldReturnANewRegionAsAModel()
        {
            var country = new Country();
            
            var result = _regionController.Add(country);

            result.Model.Should().BeOfType<Region>();
        }
Esempio n. 6
0
        public void CountryService_AddCountry_ShouldAddCountryToSession()
        {
            var country = new Country { Name = "UK", ISOTwoLetterCode = "GB" };

            _countryService.AddCountry(country);

            Session.QueryOver<Country>().List().Should().HaveCount(1);
        }
Esempio n. 7
0
        public void CountryController_AddPost_CallsAddCountryWithPassedValue()
        {
            var country = new Country() { Name = "Great Britain", ISOTwoLetterCode = "GB" };

            _countryController.Add_POST(country);

            A.CallTo(() => _countryService.AddCountry(country)).MustHaveHappened();
        }
Esempio n. 8
0
 public void AddCountry(Country country)
 {
     //_session.Transact(
     //    session =>
     //    session.Save(new Country {ISOTwoLetterCode = countryCode, Name = CountryIsoCodeAndNames[countryCode]}));
     _session.Transact(
        session =>
        session.Save(country));
 }
Esempio n. 9
0
        public void CountryService_Delete_ShouldRemoveCountryFromSession()
        {
            var country = new Country {Name = "UK", ISOTwoLetterCode = "GB"};
            Session.Transact(session => session.Save(country));

            _countryService.Delete(country);
            Session.Evict(country);

            Session.QueryOver<Country>().RowCount().Should().Be(0);
        }
Esempio n. 10
0
        public void CountryService_Save_ShouldUpdateCountry()
        {
            var country = new Country {Name = "UK", ISOTwoLetterCode = "GB"};
            Session.Transact(session => session.Save(country));
            country.Name = "United Kingdom";

            _countryService.Save(country);
            Session.Evict(country);

            Session.QueryOver<Country>().SingleOrDefault().Name.Should().Be("United Kingdom");
        }
Esempio n. 11
0
        public string ProcessCountries(NopCommerceDataReader dataReader, 
            NopImportContext nopImportContext)
        {
            var countryDatas = dataReader.GetCountryData();
            _session.Transact(session =>
            {
                foreach (CountryData countryData in countryDatas)
                {
                    var country = new Country
                    {
                        Name = countryData.Name,
                        ISOTwoLetterCode = countryData.IsoCode
                    };
                    session.Save(country);
                    nopImportContext.AddEntry(countryData.Id, country);
                }
            });

            return string.Format("{0} countries processed", countryDatas.Count);
        }
Esempio n. 12
0
        public void CountryController_EditPost_ShouldCallSaveCountry()
        {
            var country = new Country();

            _countryController.Edit_POST(country);

            A.CallTo(() => _countryService.Save(country)).MustHaveHappened();
        }
Esempio n. 13
0
        public void CountryController_DeletePOST_ShouldRedirectToIndex()
        {
            var country = new Country();

            var result = _countryController.Delete_POST(country);

            result.RouteValues["action"].Should().Be("Index");
        }
Esempio n. 14
0
        public void CountryController_DeletePOST_ShouldCallCountryServiceDeleteOnPassedCountry()
        {
            var country = new Country();

            _countryController.Delete_POST(country);

            A.CallTo(() => _countryService.Delete(country)).MustHaveHappened();
        }
Esempio n. 15
0
        public void CountryController_Delete_ShouldUsePassedCountryAsModel()
        {
            var country = new Country();

            var delete = _countryController.Delete(country);
            
            delete.Model.Should().Be(country);
        }
Esempio n. 16
0
        public void CountryController_EditPost_RedirectsToIndex()
        {
            var country = new Country();

            var result = _countryController.Edit_POST(country);

            result.RouteValues["action"].Should().Be("Index");
        }
Esempio n. 17
0
 public void Save(Country country)
 {
     _session.Transact(session => session.SaveOrUpdate(country));
 }
Esempio n. 18
0
 public void Delete(Country country)
 {
     _session.Transact(session => session.Delete(country));
 }
Esempio n. 19
0
        public void CountryController_Edit_ReturnsPassedCountryAsModel()
        {
            var country = new Country();

            var result = _countryController.Edit(country);

            result.Model.Should().Be(country);
        }