Esempio n. 1
0
        public void RegionController_Edit_ReturnsAPartialView()
        {
            var region = new Region();

            var edit = _regionController.Edit(region);

            edit.Should().BeOfType<PartialViewResult>();
        }
Esempio n. 2
0
        public void RegionController_AddPost_ShouldCallAddRegion()
        {
            var region = new Region();
            
            var post = _regionController.Add_POST(region);

            A.CallTo(() => _regionService.Add(region)).MustHaveHappened();
        }
Esempio n. 3
0
 public void Add(Region region)
 {
     _session.Transact(session =>
                           {
                               session.Save(region);
                               if (region.Country != null)
                                   region.Country.Regions.Add(region);
                           });
 }
Esempio n. 4
0
        public void RegionController_AddPost_ShouldRedirectToCountryIndex()
        {
            var region = new Region();

            var post = _regionController.Add_POST(region);

            post.RouteValues["action"].Should().Be("Index");
            post.RouteValues["controller"].Should().Be("Country");
        }
Esempio n. 5
0
        public void RegionService_Delete_ShouldRemoveRegionFromTheSession()
        {
            var region = new Region();
            Session.Transact(session => session.Save(region));

            _regionService.Delete(region);

            Session.QueryOver<Region>().RowCount().Should().Be(0);
        }
Esempio n. 6
0
        public void RegionService_Update_ShouldUpdateInSession()
        {
            var region = new Region();
            Session.Transact(session => session.Save(region));
            region.Name = "updated";

            _regionService.Update(region);
            Session.Evict(region);

            Session.Get<Region>(1).Name.Should().Be("updated");
        }
Esempio n. 7
0
        public string ProcessRegions(NopCommerceDataReader dataReader, NopImportContext nopImportContext)
        {

            HashSet<RegionData> regionDatas = dataReader.GetRegionData();
            _session.Transact(session =>
            {
                foreach (RegionData regionData in regionDatas)
                {
                    var region = new Region
                    {
                        Name = regionData.Name,
                        Country = nopImportContext.FindNew<Country>(regionData.CountryId)
                    };
                    session.Save(region);
                    nopImportContext.AddEntry(regionData.Id, region);
                }
            });

            return string.Format("{0} regions processed", regionDatas.Count);

        }
Esempio n. 8
0
 public void Delete(Region region)
 {
     _session.Transact(session => session.Delete(region));
 }
Esempio n. 9
0
 public void Update(Region region)
 {
     _session.Transact(session => session.Update(region));
 }
Esempio n. 10
0
        public void RegionController_EditPOST_ShouldCallSaveRegion()
        {
            var region = new Region();
            
           _regionController.Edit_POST(region);

            A.CallTo(() => _regionService.Update(region)).MustHaveHappened();
        }
Esempio n. 11
0
        public void RegionController_Edit_ReturnsThePassedObject()
        {
            var region = new Region();

            var edit = _regionController.Edit(region);

            edit.Model.Should().Be(region);
        }
Esempio n. 12
0
        public void RegionController_DeletePOST_ShouldRedirectToCountryIndex()
        {
            var region = new Region();

            var result = _regionController.Delete_POST(region);

            result.RouteValues["action"].Should().Be("Index");
            result.RouteValues["controller"].Should().Be("Country");
        }
Esempio n. 13
0
        public void RegionController_DeletePOST_ShouldCallRegionServiceDelete()
        {
            var region = new Region();

            _regionController.Delete_POST(region);

            A.CallTo(() => _regionService.Delete(region)).MustHaveHappened();
        }
Esempio n. 14
0
        public void RegionController_Delete_ShouldReturnPassedRegionAsTheModel()
        {
            var region = new Region();

            var delete = _regionController.Delete(region);

            delete.Model.Should().Be(region);
        }
Esempio n. 15
0
        public void RegionController_Delete_ShouldReturnAPartialViewResult()
        {
            var region = new Region();

            var delete = _regionController.Delete(region);

            delete.Should().BeOfType<PartialViewResult>();
        }