Exemplo n.º 1
0
        public void DateTimeDifferenceDesignerViewModel_ShouldSetInputFormat_WhenNoInputFormat()
        {
            var modelItem             = CreateModelItem();
            var viewModel             = new TestDotNetDateTimeDifferenceDesignerViewModel(modelItem);
            var expectedDefaultFormat = GlobalConstants.Dev2DotNetDefaultDateTimeFormat;

            Assert.AreEqual(expectedDefaultFormat, viewModel.InputFormat);
        }
Exemplo n.º 2
0
        public void DateTimeDifferenceDesignerViewModel_Constructor_ModelItemIsValid_SelectedOutputTypeAreInitialized()
        {
            var modelItem = CreateModelItem();
            var viewModel = new TestDotNetDateTimeDifferenceDesignerViewModel(modelItem);
            var expected  = new List <string>(DateTimeComparer.OutputFormatTypes);

            CollectionAssert.AreEqual(expected, viewModel.OutputTypes);
        }
Exemplo n.º 3
0
        public void DateTimeDifferenceDesignerViewModel_ShouldNotSetInputFormat_WhenInputFormat()
        {
            var modelItem             = CreateModelItem("yyyy-mm-dd");
            var viewModel             = new TestDotNetDateTimeDifferenceDesignerViewModel(modelItem);
            var expectedDefaultFormat = GlobalConstants.PreviousDev2DotNetDefaultDateTimeFormat;

            Assert.AreNotEqual(expectedDefaultFormat, viewModel.InputFormat);
            Assert.AreEqual("yyyy-mm-dd", viewModel.InputFormat);
        }
Exemplo n.º 4
0
        public void DateTimeDifferenceDesignerViewModel_Constructor_ModelItemIsValid_SelectedOutputTypeIsInitialized()
        {
            var modelItem = CreateModelItem();
            var viewModel = new TestDotNetDateTimeDifferenceDesignerViewModel(modelItem);

            Assert.AreEqual("Years", viewModel.OutputType);
            Assert.AreEqual("Years", viewModel.SelectedOutputType);
            Assert.IsTrue(viewModel.HasLargeView);
        }
Exemplo n.º 5
0
        public void DateTimeDifferenceDesignerViewModel_SetSelectedOutputType_ValidType_OutputTypeOnModelItemIsAlsoSet()
        {
            var modelItem = CreateModelItem();
            var viewModel = new TestDotNetDateTimeDifferenceDesignerViewModel(modelItem);

            viewModel.Validate();
            const string ExpectedValue = "Normal";

            viewModel.SelectedOutputType = ExpectedValue;
            Assert.AreEqual(ExpectedValue, viewModel.OutputType);
        }
Exemplo n.º 6
0
        public void DateTimeDifferenceDesignerViewModel_UpdateHelp_ShouldCallToHelpViewMode()
        {
            //------------Setup for test--------------------------
            var mockMainViewModel = new Mock <IShellViewModel>();
            var mockHelpViewModel = new Mock <IHelpWindowViewModel>();

            mockHelpViewModel.Setup(model => model.UpdateHelpText(It.IsAny <string>())).Verifiable();
            mockMainViewModel.Setup(model => model.HelpViewModel).Returns(mockHelpViewModel.Object);
            CustomContainer.Register(mockMainViewModel.Object);
            var viewModel = new TestDotNetDateTimeDifferenceDesignerViewModel(CreateModelItem());

            //------------Execute Test---------------------------
            viewModel.UpdateHelpDescriptor("help");
            //------------Assert Results-------------------------
            mockHelpViewModel.Verify(model => model.UpdateHelpText(It.IsAny <string>()), Times.Once());
        }