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); }
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); }
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); }
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); }
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); }