Exemplo n.º 1
0
        public void TestNewFinishCommand()
        {
            FinishCommand command = MvcFactory.NewFinishCommand();

            Assert.IsNotNull(command);
            Assert.IsInstanceOf(typeof(FinishCommandImpl), command);
        }
Exemplo n.º 2
0
        public void CreateDefinition()
        {
            ApplicationDefinition application     = University.Create();
            ApplicationInfo       applicationInfo = new ApplicationInfo();

            applicationInfo.Set(application);

            CrudCreator crudCreator = new CrudCreator();

            crudCreator.Create(applicationInfo);

            Shipment shipment = new Shipment();

            EfFactory factory = new EfFactory();

            factory.Manufacture(shipment, applicationInfo);

            EnumerationFactory enumerationFactory = new EnumerationFactory();

            enumerationFactory.Manufacture(shipment, applicationInfo);

            MvcFactory mvcFactory = new MvcFactory();

            mvcFactory.Manufacture(shipment, applicationInfo);

            shipment.Save(@"C:\Sources\Plastic\Plastic.University");
        }
Exemplo n.º 3
0
        public void TestNewStartCommand()
        {
            StartCommand command = MvcFactory.NewStartCommand();

            Assert.IsNotNull(command);
            Assert.IsInstanceOf(typeof(StartCommandImpl), command);
        }
Exemplo n.º 4
0
        [Test] public void TestNewUnknownCommand()
        {
            UnknownCommand command = MvcFactory.NewUnknownCommand("a comment string");

            Assert.That(command, Is.Not.Null);
            Assert.That(command, Is.InstanceOf(typeof(UnknownCommandImpl)));
            Assert.That(command.Comment, Is.EqualTo("a comment string"));
        }
Exemplo n.º 5
0
        public void TestRun()
        {
            Controller         mockController     = MockMvcFactory.NewMockController(MvcFactory);
            MockControllerImpl mockControllerImpl = (MockControllerImpl)mockController;
            FinishCommand      command            = MvcFactory.NewFinishCommand();

            command.Process(mockController);
            Assert.IsTrue(mockControllerImpl.FinishCommandsProcessed.Contains(command));
        }
        public void ActionsArePrepared()
        {
            var types =
                typeof(EchoAction).Assembly.GetTypes().Where(x => typeof(IAction).IsAssignableFrom(x) && !x.IsAbstract);

            foreach (var type in types)
            {
                Assert.NotNull(container.Get <IAction>(MvcFactory.NormalizeActionName(ActionAttribute.GetName(type))), type.FullName);
            }
        }
Exemplo n.º 7
0
        public void TestNewSafeView()
        {
            View unsafeView = new MockViewImpl();
            View safeView   = MvcFactory.NewSafeView(unsafeView);

            Assert.That(safeView, Is.Not.Null);
            Assert.That(safeView, Is.InstanceOf(typeof(SafeViewImpl)));
            SafeViewImpl safeViewImpl = safeView as SafeViewImpl;

            Assert.That(safeViewImpl.UnsafeView, Is.EqualTo(unsafeView));
        }
Exemplo n.º 8
0
        public void TestProcess()
        {
            Controller         mockController     = MockMvcFactory.NewMockController(this.MvcFactory);
            MockControllerImpl mockControllerImpl = (MockControllerImpl)mockController;
            StartCommand       startCommand       = MvcFactory.NewStartCommand();
            FinishCommand      finishCommand      = MvcFactory.NewFinishCommand();

            mockController.Process(startCommand);
            mockController.Process(finishCommand);
            Assert.IsTrue(mockControllerImpl.StartCommandsProcessed.Contains(startCommand));
            Assert.IsTrue(mockControllerImpl.FinishCommandsProcessed.Contains(finishCommand));
        }
Exemplo n.º 9
0
        public void TestNewModelAndView()
        {
            IDictionary <string, object> model = new Dictionary <string, object>();

            model.Add("modelComponent1", "modelValue1");
            string       viewName     = "testViewName";
            ModelAndView modelAndView = MvcFactory.NewModelAndView(model, viewName);

            Assert.IsNotNull(modelAndView);
            Assert.IsInstanceOf(typeof(ModelAndViewImpl), modelAndView);
            Assert.AreEqual(model, modelAndView.Model);
            Assert.AreEqual(viewName, modelAndView.ViewName);
        }
Exemplo n.º 10
0
        public void TestNewDriver()
        {
            ViewResolver viewResolver = MockMvcFactory.NewMockViewResolver();
            Input        input        = MockMvcFactory.NewMockInput();
            Output       output       = MockMvcFactory.NewMockOutput(viewResolver);
            Controller   controller   = MockMvcFactory.NewMockController(MvcFactory);
            Driver       driver       = MvcFactory.NewDriver(input, output, controller);

            Assert.IsNotNull(driver);
            Assert.IsInstanceOf(typeof(DriverImpl), driver);
            DriverImpl driverImpl = (DriverImpl)driver;

            Assert.AreEqual(MvcFactory, driverImpl.Factory);
            Assert.AreEqual(input, driverImpl.Input);
            Assert.AreEqual(output, driverImpl.Output);
            Assert.AreEqual(controller, driverImpl.Controller);
            Assert.IsTrue(LoggerSetterImpl.LoggerRecipients.Contains(driver));
        }
Exemplo n.º 11
0
        public void TestToString()
        {
            FinishCommand command = MvcFactory.NewFinishCommand();

            Assert.AreEqual("FinishCommand", command.ToString());
        }
Exemplo n.º 12
0
        public void TestToString()
        {
            StartCommand command = MvcFactory.NewStartCommand();

            Assert.AreEqual("StartCommand", command.ToString());
        }