public void GoogleBaseController_Dashboard_ShouldReturnViewResult() { var model = new GoogleBaseModel(); var result = _googleBaseController.Dashboard(model); result.Should().BeOfType <ViewResult>(); }
public void GoogleBaseController_Dashboard_ShouldReturnNonEmptyModel() { var model = new GoogleBaseModel(); A.CallTo(() => _productVariantService.GetAllVariants(string.Empty, 0, 1)) .Returns(new PagedList <ProductVariant>(new List <ProductVariant>(), 1, 10)); var result = _googleBaseController.Dashboard(model); result.Model.Should().NotBeNull(); }
public ViewResult Dashboard(GoogleBaseModel model) { ViewData["settings"] = _googleBaseSettings; ViewData["categories"] = _optionService.GetCategoryOptions(); ViewData["product-conditions"] = _optionService.GetEnumOptions <ProductCondition>(); ViewData["genders"] = _optionService.GetEnumOptions <Gender>(); ViewData["age-groups"] = _optionService.GetEnumOptions <AgeGroup>(); model.Items = _productVariantService.GetAllVariants(model.Name, model.Category.HasValue ? model.Category.Value : 0, model.Page); return(View(model)); }
public void GoogleBaseController_Dashboard_ShouldCall5ServicesToGetOptions() { var model = new GoogleBaseModel(); A.CallTo(() => _productVariantService.GetAllVariants(string.Empty, 0, 1)) .Returns(new PagedList <ProductVariant>(new List <ProductVariant>(), 1, 10)); _googleBaseController.Dashboard(model); A.CallTo(() => _optionService.GetEnumOptions <ProductCondition>()).MustHaveHappened(); A.CallTo(() => _optionService.GetCategoryOptions()).MustHaveHappened(); A.CallTo(() => _optionService.GetEnumOptions <Gender>()).MustHaveHappened(); A.CallTo(() => _optionService.GetEnumOptions <AgeGroup>()).MustHaveHappened(); }