Exemplo n.º 1
0
        public void ExecuteFormRequiresPostDispatch()
        {
            var dispatcher = new FormDispatcher <RazorPage1>();

            dispatcher.Dispatch(context, Mock.Of <ILoggingService>()).Wait();

            Assert.AreEqual(405, statusCode);
            Assert.AreEqual(null, context.InternalServiceProvider.GetService <RazorPage1>().result);
        }
Exemplo n.º 2
0
        public void ExecuteFormSaveOnDispatch()
        {
            SetupContext("post");

            var dispatcher = new FormDispatcher <RazorPage1>();

            dispatcher.Dispatch(context, Mock.Of <ILoggingService>()).Wait();


            var page = context.InternalServiceProvider.GetService <RazorPage1>();

            Assert.AreEqual("test123", location);            //returned dispatcher
            Assert.AreEqual("saved", page.result);           //saved
            Assert.AreEqual("12", page.formValues["id"][0]); //set form
            Assert.IsNotNull(page.LoggingService);
        }