Пример #1
0
        public void GetVirtualPath_RegisteredWidget_ReturnsVirtualPathForItsAssembly()
        {
            var controllerAssembly = typeof(DummyController).Assembly;
            var vpBuilder = new VirtualPathBuilder();
            var expected = vpBuilder.GetVirtualPath(controllerAssembly);

            using (var factoryReg = new ControllerFactoryRegion<DummyControllerFactory>())
            {
                factoryReg.Factory.ControllerRegistry["Dummy"] = typeof(DummyController);

                var result = vpBuilder.GetVirtualPath(typeof(DummyController));
                Assert.AreEqual(expected, result);
            }
        }
        public void GetVirtualPath_RegisteredWidget_ReturnsVirtualPathForItsAssembly()
        {
            // Arrange
            Assembly controllerAssembly = typeof(DummyController).Assembly;
            var virtualPathBuilder = new VirtualPathBuilder();
            string expected = virtualPathBuilder.GetVirtualPath(controllerAssembly);

            using (var factoryReg = new ControllerFactoryRegion<DummyControllerFactory>())
            {
                factoryReg.Factory.ControllerRegistry["Dummy"] = typeof(DummyController);

                // Act
                string result = virtualPathBuilder.GetVirtualPath(typeof(DummyController));

                // Assert
                Assert.AreEqual(expected, result, "The virtual path is not retrieved properly.");
            }
        }