コード例 #1
0
        public void WhenDefaultIndexMethodCalledWithNOPageId_InValidViewModelReturned()
        {
            // Arrange
            this.pageId = null;

            this.InitializeConstructorParameters();
            this.RespositoryMockSetup();
            this.InitializeServices();

            // Act
            var controller = new WebFrameworkController(
                this.domainService,
                this.clientAssetConfigService,
                this.clientAssetService,
                this.clientAssetTypeService,
                this.pageService,
                this.pageTemplateService,
                this.pageTemplateZoneMapService,
                this.pageZoneService,
                this.partService,
                this.partTypeService,
                this.seoDecoratorService,
                this.userService,
                this.partContainerService);

            // Asserts
            Assert.Throws<InvalidOperationException>(() => controller.Index((int)this.pageId));
        }
コード例 #2
0
        public void WhenDefaultIndexMethodCalledWithPageId_ValidViewModelReturned()
        {
            // Arrange
            this.pageId = 1;

            this.InitializeConstructorParameters();
            this.RespositoryMockSetup();
            this.InitializeServices();

            // Act
            var controller = new WebFrameworkController(
                this.domainService,
                this.clientAssetConfigService,
                this.clientAssetService,
                this.clientAssetTypeService,
                this.pageService,
                this.pageTemplateService,
                this.pageTemplateZoneMapService,
                this.pageZoneService,
                this.partService,
                this.partTypeService,
                this.seoDecoratorService,
                this.userService,
                this.partContainerService);

            // Asserts
            var viewResult = controller.Index((int)this.pageId) as ViewResult;

            Assert.NotNull(viewResult);
            Assert.Equal(string.Empty, viewResult.ViewName);
            Assert.True(viewResult.ViewData.ModelState.IsValid);
            Assert.True(controller.ModelState.IsValid);
        }