Ejemplo n.º 1
0
        public void IntPropertyDefault() {
          
            var mocks = new ContextMocks(controller);
            INakedObject adapter = FrameworkHelper.GetNakedObject(new CustomHelperTestClass());
            mocks.ViewDataContainer.Object.ViewData.Model = adapter.Object;
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();

            mocks.ViewDataContainer.Object.ViewData["CustomHelperTestClass-TestIntDefault-Input"] = PersistorUtils.CreateAdapter(0);

            string s = mocks.GetHtmlHelper<CustomHelperTestClass>().ObjectPropertyEdit(y => y.TestIntDefault).ToString();

            CheckResults("TestIntDefault", s);
        }
Ejemplo n.º 2
0
        public void DateTimePropertyEdit() {

            var mocks = new ContextMocks(controller);
            INakedObject adapter = FrameworkHelper.GetNakedObject(new NotPersistedTestClass());
            mocks.ViewDataContainer.Object.ViewData.Model = adapter.Object;
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();
            string s = mocks.GetHtmlHelper<NotPersistedTestClass>().ObjectPropertyEdit(y => y.TestDateTime).ToString();
       

            CheckResults("TestDateTime", s);
        }
Ejemplo n.º 3
0
        public void OneRefParameterPopulatedActionAsDialog() {

            var mocks = new ContextMocks(controller);
            var tc = (CustomHelperTestClass)GetTestService("Custom Helper Test Classes").GetAction("New Instance").InvokeReturnObject().NakedObject.Object;
            mocks.ViewDataContainer.Object.ViewData.Model = tc;
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();
            mocks.ViewDataContainer.Object.ViewData["CustomHelperTestClass-OneRefParameterAction-Parm-Select"] = PersistorUtils.CreateAdapter(tc);

            string s = mocks.GetHtmlHelper<CustomHelperTestClass>().ObjectActionAsDialog<CustomHelperTestClass, CustomHelperTestClass>(y => y.OneRefParameterAction).ToString();
   

            CheckResults("OneRefParameterPopulatedActionAsDialog", s);
        }
Ejemplo n.º 4
0
        public void RefPropertyStringEditExistingValue() {

            var mocks = new ContextMocks(controller);
            var tc = (CustomHelperTestClass)GetTestService("Custom Helper Test Classes").GetAction("New Instance").InvokeReturnObject().NakedObject.Object;
            mocks.ViewDataContainer.Object.ViewData.Model = tc;
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();

            var id = FrameworkHelper.GetObjectId(tc);
            mocks.ViewDataContainer.Object.ViewData.ModelState.SetModelValue("CustomHelperTestClass-TestRef-Select", new ValueProviderResult(id, null, null));
            
            string s = mocks.GetHtmlHelper<CustomHelperTestClass>().ObjectPropertyEdit("TestRef").ToString();
       
            CheckResults("RefPropertyStringEditExistingValue", s);
        }
Ejemplo n.º 5
0
        public void TestClientValidationHtml() {

            var mocks = new ContextMocks(controller);
            mocks.ViewDataContainer.Object.ViewData.Model = DescribedTestClass;
            string s = mocks.GetHtmlHelper<DescribedCustomHelperTestClass>().PropertyListEdit(mocks.ViewDataContainer.Object.ViewData.Model).ToString();

            CheckResults("ClientValidationHtml", s);
        }
Ejemplo n.º 6
0
        public void TestClientValidationHtmlDialog() {
            var mocks = new ContextMocks(controller);
            mocks.ViewDataContainer.Object.ViewData.Model = DescribedTestClass;
            string s = mocks.GetHtmlHelper<DescribedCustomHelperTestClass>().ObjectActionAsDialog<DescribedCustomHelperTestClass, string, int, string, string>(DescribedTestClass, x => x.TestClientValidationFunction).ToString();

            CheckResults("ClientValidationHtmlDialog", s);
        }
Ejemplo n.º 7
0
        public void NullableBoolParameter() {
            var mocks = new ContextMocks(controller);
            var btc = new BoolTestClass();
            mocks.ViewDataContainer.Object.ViewData.Model = btc;
            PersistorUtils.CreateAdapter(btc);
            string s = mocks.GetHtmlHelper<BoolTestClass>().ObjectActionAsDialog<BoolTestClass, bool?>(btc, x => x.TestNullableBoolAction).ToString();


            CheckResults("NullableBoolParameter", s);
        }
Ejemplo n.º 8
0
        public void ParameterWithHint() {
            var mocks = new ContextMocks(controller);

            var hint = (HintTestClass)GetBoundedInstance<HintTestClass>("HintTestClass").GetDomainObject();
            mocks.ViewDataContainer.Object.ViewData.Model = hint;
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();
            FrameworkHelper.GetNakedObject(hint);

            string s = mocks.GetHtmlHelper<HintTestClass>().ObjectActionAsDialog<HintTestClass, int, int>(hint, x => x.ActionWithParms).ToString();

            CheckResults("ParameterWithHint", s);
        }
Ejemplo n.º 9
0
        public void NotPersistedPropertyList() {
            


            var mocks = new ContextMocks(controller);
            INakedObject adapter = FrameworkHelper.GetNakedObject(NotPersistedTestClass);
            mocks.ViewDataContainer.Object.ViewData.Model = adapter.Object;
            string s = mocks.GetHtmlHelper<NotPersistedTestClass>().PropertyList(adapter.Object).ToString();
          

            CheckResults("NotPersistedPropertyList", s);
        }
Ejemplo n.º 10
0
        public void MultiLineParameter() {
            var mocks = new ContextMocks(controller);
            mocks.ViewDataContainer.Object.ViewData.Model = DescribedTestClass;
            string s = mocks.GetHtmlHelper<DescribedCustomHelperTestClass>().ObjectActionAsDialog<DescribedCustomHelperTestClass, string>(DescribedTestClass, x => x.TestMultiLineFunction).ToString();
           

            CheckResults("MultilineParameter", s);
        }
Ejemplo n.º 11
0
        public void MultiLineFieldView() {
            var mocks = new ContextMocks(controller);
            DescribedCustomHelperTestClass tc = DescribedTestClass;
            tc.TestMultiLineString = "Test String";

            mocks.ViewDataContainer.Object.ViewData.Model = tc;
            string s = mocks.GetHtmlHelper<DescribedCustomHelperTestClass>().PropertyListWith(tc, x => x.TestMultiLineString).ToString();
        

            CheckResults("MultilineFieldView", s);
        }
Ejemplo n.º 12
0
        public void DuplicateAction() {
            var mocks = new ContextMocks(controller);
            mocks.ViewDataContainer.Object.ViewData[IdHelper.NofServices] = FrameworkHelper.GetServices();
            var testBool = (BoolTestClass)GetBoundedInstance<BoolTestClass>("BoolClass").GetDomainObject();

            string s = mocks.GetHtmlHelper<BoolTestClass>().Menu(testBool).ToString();
            CheckResults("DuplicateAction", s);
        }
Ejemplo n.º 13
0
 public void DisplayName() {
     var mocks = new ContextMocks(controller);
     mocks.ViewDataContainer.Object.ViewData.Model = DescribedTestClass;
     string s = mocks.GetHtmlHelper<DescribedCustomHelperTestClass>().Menu(DescribedTestClass).ToString();
  
     CheckResults("DisplayName", s);
 }