public void AddNewCalendar()
        {
            // arrange
            var vm = new CalendarDetailsViewModel();

            var dynamicTypeManager = Mock.Create<IDynamicTypeManager>(Behavior.Loose);

            var called = false;
            Mock.Arrange(() => dynamicTypeManager.BeginNewRetriever(Constants.CalendarProcessName, Arg.IsAny<Action<object, IDataPortalResult>>())).DoInstead(() => called = true);

            vm.TheDynamicTypeManager = new Lazy<IDynamicTypeManager>(() => dynamicTypeManager);

            // act
            vm.NewEditableRoot();

            // assert
            Assert.IsTrue(called);
        }
        public void AddNewCalendar_CheckCurrentIfSaved_Accept()
        {
            // arrange
            var vm = new CalendarDetailsViewModel();

            var dynamicTypeManager = Mock.Create<IDynamicTypeManager>(Behavior.Loose);
            var popupFactory = Mock.Create<PopupFactory>(Behavior.Loose);

            Mock.Arrange(() => vm.IsSaveable).Returns(true);

            var called = false;
            var confirmMessageShown = false;
            Mock.Arrange(() => popupFactory.Confirm(Arg.AnyString, Arg.IsAny<Action>())).DoInstead<string, Action>((s, a) => { confirmMessageShown = true; a(); });
            Mock.Arrange(() => dynamicTypeManager.BeginNewRetriever(Constants.CalendarProcessName, Arg.IsAny<Action<object, IDataPortalResult>>())).DoInstead(() => called = true);

            vm.TheDynamicTypeManager = new Lazy<IDynamicTypeManager>(() => dynamicTypeManager);
            vm.ThePopupFactory = new Lazy<PopupFactory>(() => popupFactory);

            // act
            vm.NewEditableRoot();

            // assert
            Assert.IsTrue(called);
            Assert.IsTrue(confirmMessageShown);
        }
        public void AddNewCalendarCommand()
        {
            // arrange
            var vm = new CalendarDetailsViewModel();
            var called = false;
            Mock.Arrange(() => vm.NewEditableRoot()).DoInstead(() => called = true);
            Mock.Arrange(() => vm.CanAddItem).Returns(true);

            // act
            vm.AddNewCalendarCommand.Execute(null);

            // assert
            Assert.IsTrue(called);
        }