public void Return_DistributionDetailModel() { var mockDistributionService = new Mock <IDistribution>(); mockDistributionService.Setup(r => r.Get(123)).Returns(GetDistributionCenter()); var controller = new DistributionController(mockDistributionService.Object); var result = controller.Detail(123); var viewResult = result.Should().BeOfType <ViewResult>(); viewResult.Subject.Model.Should().BeOfType <DistributionDetailModel>(); }
public void Return_DistributionIndexModel() { var mockDistributionService = new Mock <IDistribution>(); mockDistributionService.Setup(r => r.GetAll()).Returns(GetAllDistributions()); var controller = new DistributionController(mockDistributionService.Object); var result = controller.Index(""); var viewResult = result.Should().BeOfType <ViewResult>(); viewResult.Subject.Model.Should().BeOfType <DistributionIndexModel>(); }
public void Return_Distribution_Index_View() { var mockDistributionService = new Mock <IDistribution>(); mockDistributionService.Setup(c => c.GetAll()).Returns(GetAllDistributions()); var controller = new DistributionController(mockDistributionService.Object); var result = controller.Index(""); var viewResult = result.Should().BeOfType <ViewResult>(); var viewModel = viewResult.Subject.ViewData.Model.Should().BeAssignableTo <DistributionIndexModel>(); viewModel.Subject.DistributionCenters.Count().Should().Be(3); }
public void Return_Distribution_Detail_View() { var mockDistributionService = new Mock <IDistribution>(); mockDistributionService.Setup(r => r.Get(123)).Returns(GetDistributionCenter()); var controller = new DistributionController(mockDistributionService.Object); var result = controller.Detail(123); var viewResult = result.Should().BeOfType <ViewResult>(); var viewModel = viewResult.Subject.ViewData.Model.Should().BeAssignableTo <DistributionDetailModel>(); viewModel.Subject.Address.Should().Be("123 Example Street, Boston MA, 12345"); viewModel.Subject.Telephone.Should().Be("123-456-7890"); }