Beispiel #1
0
 public void MR_262_DynamicComponents()
 {
     ViewComponentFactory.Inspect(typeof(BugsController).Assembly);
     PropertyBag["components"] = new[]
     {
         "SimpleInlineViewComponent3",
         "SimpleInlineViewComponent2"
     };
     ProcessView_StripRailsExtension("usingcomponents/DynamicComponents.rails");
     AssertReplyEqualTo("default component view picked up automaticallyThis is a view used by a component");
 }
        public ViewComponentFactoryTests()
        {
            ViewContext viewContext = new ViewContext
                                          {
                                              HttpContext = TestHelper.CreateMockedHttpContext().Object,
                                              ViewData = new ViewDataDictionary()
                                          };

            StyleSheetRegistrar styleSheetRegistrar = new StyleSheetRegistrar(new WebAssetItemCollection(WebAssetDefaultSettings.StyleSheetFilesPath), new List<IStyleableComponent>(), viewContext, new Mock<IWebAssetItemMerger>().Object);
            StyleSheetRegistrarBuilder styleSheetRegistrarBuilder = new StyleSheetRegistrarBuilder(styleSheetRegistrar);

            ScriptRegistrar scriptRegistrar = new ScriptRegistrar(new WebAssetItemCollection(WebAssetDefaultSettings.ScriptFilesPath), new List<IScriptableComponent>(), viewContext, new Mock<IWebAssetItemMerger>().Object, new Mock<ScriptWrapperBase>().Object);
            ScriptRegistrarBuilder scriptRegistrarBuilder = new ScriptRegistrarBuilder(scriptRegistrar);

            _factory = new ViewComponentFactory(styleSheetRegistrarBuilder, scriptRegistrarBuilder);
        }
        public ViewComponentFactoryTests()
        {
            ViewContext viewContext = new ViewContext
            {
                HttpContext = TestHelper.CreateMockedHttpContext().Object,
                ViewData    = new ViewDataDictionary()
            };

            StyleSheetRegistrar        styleSheetRegistrar        = new StyleSheetRegistrar(new WebAssetCollection(WebAssetDefaultSettings.StyleSheetFilesPath), viewContext, new Mock <IWebAssetCollectionResolver>().Object);
            StyleSheetRegistrarBuilder styleSheetRegistrarBuilder = new StyleSheetRegistrarBuilder(styleSheetRegistrar);

            ScriptRegistrar        scriptRegistrar        = new ScriptRegistrar(new WebAssetCollection(WebAssetDefaultSettings.ScriptFilesPath), new List <IScriptableComponent>(), viewContext, new Mock <IWebAssetCollectionResolver>().Object, new Mock <ScriptWrapperBase>().Object);
            ScriptRegistrarBuilder scriptRegistrarBuilder = new ScriptRegistrarBuilder(scriptRegistrar);

            htmlHelper = TestHelper.CreateHtmlHelper();
            _factory   = new ViewComponentFactory(htmlHelper, new Mock <IClientSideObjectWriterFactory>().Object, styleSheetRegistrarBuilder, scriptRegistrarBuilder);
        }
        public ViewComponentModelFactoryTests()
        {
            ViewContext viewContext = new ViewContext
            {
                HttpContext = TestHelper.CreateMockedHttpContext().Object,
                ViewData    = new ViewDataDictionary()
            };

            StyleSheetRegistrar        styleSheetRegistrar        = new StyleSheetRegistrar(new WebAssetCollection(WebAssetDefaultSettings.StyleSheetFilesPath), viewContext, new Mock <IWebAssetCollectionResolver>().Object);
            StyleSheetRegistrarBuilder styleSheetRegistrarBuilder = new StyleSheetRegistrarBuilder(styleSheetRegistrar);

            ScriptRegistrar        scriptRegistrar        = new ScriptRegistrar(new WebAssetCollection(WebAssetDefaultSettings.ScriptFilesPath), new List <IScriptableComponent>(), viewContext, new Mock <IWebAssetCollectionResolver>().Object, new Mock <ScriptWrapperBase>().Object);
            ScriptRegistrarBuilder scriptRegistrarBuilder = new ScriptRegistrarBuilder(scriptRegistrar);

            htmlHelper = TestHelper.CreateHtmlHelper <TestModel>();

            htmlHelper.ViewData.Model = new TestModel {
                ID = 1, DoubleProperty = 1.0, DecimalProperty = 1.0m, DateTimeProperty = DateTime.Today, TimeProperty = DateTime.Now.TimeOfDay, ComplexModel = new TestModel()
            };

            factory = new ViewComponentFactory <TestModel>(htmlHelper, new Mock <IClientSideObjectWriterFactory>().Object, styleSheetRegistrarBuilder, scriptRegistrarBuilder);
        }
 public void UsingEmptyComponent()
 {
     ViewComponentFactory.Inspect(typeof(SimpleInlineViewComponent3).Assembly);
     ProcessView_StripRailsExtension("happenedOnTheField/JustComponent.rails");
     // should complete succesfully
 }
        public ViewComponentModelFactoryTests()
        {
            ViewContext viewContext = new ViewContext
                                          {
                                              HttpContext = TestHelper.CreateMockedHttpContext().Object,
                                              ViewData = new ViewDataDictionary()
                                          };

            StyleSheetRegistrar styleSheetRegistrar = new StyleSheetRegistrar(new WebAssetCollection(WebAssetDefaultSettings.StyleSheetFilesPath), viewContext, new Mock<IWebAssetCollectionResolver>().Object);
            StyleSheetRegistrarBuilder styleSheetRegistrarBuilder = new StyleSheetRegistrarBuilder(styleSheetRegistrar);

            ScriptRegistrar scriptRegistrar = new ScriptRegistrar(new WebAssetCollection(WebAssetDefaultSettings.ScriptFilesPath), new List<IScriptableComponent>(), viewContext, new Mock<IWebAssetCollectionResolver>().Object, new Mock<ScriptWrapperBase>().Object);
            ScriptRegistrarBuilder scriptRegistrarBuilder = new ScriptRegistrarBuilder(scriptRegistrar);

            htmlHelper = TestHelper.CreateHtmlHelper<TestModel>();

            htmlHelper.ViewData.Model = new TestModel { ID = 1, DoubleProperty = 1.0, DecimalProperty = 1.0m, DateTimeProperty = DateTime.Today, TimeProperty = DateTime.Now.TimeOfDay, ComplexModel = new TestModel() };

            factory = new ViewComponentFactory<TestModel>(htmlHelper, new Mock<IClientSideObjectWriterFactory>().Object, styleSheetRegistrarBuilder, scriptRegistrarBuilder);
        }
Beispiel #7
0
 protected override void BeforEachTest()
 {
     ViewComponentFactory.Inspect(typeof(BlockViewComponent2).Assembly);
 }
Beispiel #8
0
 public void MR_371_OutputComponentInSectionTooManyTimes()
 {
     ViewComponentFactory.Inspect(typeof(BugsController).Assembly);
     ProcessView_StripRailsExtension("bugs/mr_371.rails");
     AssertReplyEqualTo("123ayende 0<br/>123ayende 1<br/>123ayende 2<br/>");
 }