示例#1
0
        public void Wholesaler_WholesalerCreate_ReturnsWholesalersIndexView()
        {
            var viewModel = new WholesalerEditModel()
            {
                Wholesaler = new WholesalerDto()
                {
                    Name = "Test"
                }
            };

            var result = _wholesalersController.Create(viewModel) as RedirectToRouteResult;

            Assert.That(result.RouteValues["Action"], Is.EqualTo("Index"));
        }
        public void WholesalerController_PostCreateViewModel_DbSetReceivedAddAndContextReceivedSaveChanges()
        {
            var editModel = new WholesalerEditModel()
            {
                Wholesaler = new WholesalerDto()
                {
                    Name = "Test", IsDeleted = false
                }
            };

            _wholesalersController.Create(editModel);

            _dbSet.Received(1).Add(Arg.Any <Wholesaler>());
            _context.Received(1).SaveChanges();
        }