예제 #1
0
        public void ScheduleFieldTests()
        {
            // arrange
            var fieldViewModel = new ScheduleDateFieldViewModel();
            var popupViewModel = new ExportFactory<ScheduleDateFieldViewModel>(() => new Tuple<ScheduleDateFieldViewModel, Action>(fieldViewModel, null));

            var fieldFactory = new FieldFactory { ScheduleDateFieldViewModelFactory = popupViewModel };

            var model = new ModelStub { ScheduleDateField = DateTime.Now };
            var property = model.GetType().GetProperty("ScheduleDateField");

            // act
            var viewModel = fieldFactory.CreateField(property, null, model, new DetailsViewModel(), false);

            // assert
            Assert.IsTrue(viewModel is ScheduleDateFieldViewModel);
        }
예제 #2
0
        public void BlockedContentTests()
        {
            // arrange
            var fieldViewModel = new FieldViewModel();
            var popupViewModel = new ExportFactory<FieldViewModel>(() => new Tuple<FieldViewModel, Action>(fieldViewModel, null));

            var fieldFactory = new FieldFactory { FieldViewModelFactory = popupViewModel };

            var model = new ModelStub();
            var property = model.GetType().GetProperty("BlockedContentField");

            var detailViewMdoel = new DetailsViewModel();

            // act
            var viewModel = fieldFactory.CreateField(property, null, model, detailViewMdoel, false);

            // assert
            Assert.IsTrue(viewModel is FieldViewModel);
        }
예제 #3
0
        public void RichFieldTests()
        {
            // arrange
            var fieldViewModel = new RichTextFieldViewModel();
            var popupViewModel = new ExportFactory<RichTextFieldViewModel>(() => new Tuple<RichTextFieldViewModel, Action>(fieldViewModel, null));

            var fieldFactory = new FieldFactory { RichTextFieldViewModelFactory = popupViewModel };

            var model = new ModelStub();
            var property = model.GetType().GetProperty("RichTextField");

            // act
            var viewModel = fieldFactory.CreateField(property, null, model, new DetailsViewModel(), false);

            // assert
            Assert.IsTrue(viewModel is RichTextFieldViewModel);
        }
예제 #4
0
        public void TextFieldTests()
        {
            // arrange
            var fieldViewModel = new TextFieldViewModel();
            var popupViewModel = new ExportFactory<TextFieldViewModel>(() => new Tuple<TextFieldViewModel, Action>(fieldViewModel, null));

            var fieldFactory = new FieldFactory { TextFieldViewModelFactory = popupViewModel };

            var model = new ModelStub();
            var property = model.GetType().GetProperty("TextField");

            // act
            var viewModel = fieldFactory.CreateField(property, null, model, new DetailsViewModel(), false);

            // assert
            Assert.AreEqual(2, ((TextFieldViewModel)viewModel).NumberOfRows);
        }
예제 #5
0
        public void DateTimeFieldTests()
        {
            // arrange
            var fieldViewModel = new DateTimeFieldViewModel();
            var popupViewModel = new ExportFactory<DateTimeFieldViewModel>(() => new Tuple<DateTimeFieldViewModel, Action>(fieldViewModel, null));

            var fieldFactory = new FieldFactory { DateTimeFieldViewModelFactory = popupViewModel };

            var model = new ModelStub();
            var property = model.GetType().GetProperty("DateTimeField");

            // act
            var viewModel = fieldFactory.CreateField(property, null, model, new DetailsViewModel(), false);

            // assert
            Assert.AreEqual("Time", ((DateTimeFieldViewModel)viewModel).InputMode);
        }