public void TestIsLive() { var captureProject = new DummyProjectVM { Model = new Utils.ProjectDummy { ProjectType = ProjectType.CaptureProject } }; var fakeProject = new DummyProjectVM { Model = new Utils.ProjectDummy { ProjectType = ProjectType.FakeCaptureProject } }; var uriProject = new DummyProjectVM { Model = new Utils.ProjectDummy { ProjectType = ProjectType.URICaptureProject } }; var fileProject = new DummyProjectVM { Model = new Utils.ProjectDummy { ProjectType = ProjectType.FileProject } }; var editProject = new DummyProjectVM { Model = new Utils.ProjectDummy { ProjectType = ProjectType.EditProject } }; Assert.IsTrue(captureProject.IsLive); Assert.IsTrue(fakeProject.IsLive); Assert.IsTrue(uriProject.IsLive); Assert.IsFalse(fileProject.IsLive); Assert.IsFalse(editProject.IsLive); }
public void SetUp() { project = Utils.CreateProject(true); var projectVM = new DummyProjectVM { Model = project }; widgetMock = new Mock <IWidget> (); widgetMock.SetupAllProperties(); timeline = new EventTypeTimelineView(); timeline.ViewModel = projectVM.Timeline.EventTypesTimeline.ViewModels.First(); }
public void CreateEventTypesTimeline_5EventTypesDifferentNamesNoGrouping_5TimelinesCreated() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count); }
public void TestProperties() { var model = Utils.CreateProject(true); model.ProjectType = ProjectType.CaptureProject; var viewModel = new DummyProjectVM { Model = model }; Assert.AreEqual(model.FileSet, viewModel.FileSet.Model); Assert.AreEqual(model.ShortDescription, viewModel.ShortDescription); Assert.AreEqual(model.ProjectType, viewModel.ProjectType); }
public void RemoveEventType_TimelineEmpty_TimelineRemoved() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); var timelinesCount = viewModel.EventTypesTimeline.Count(); project.EventTypes.Remove(project.EventTypes [0]); Assert.AreEqual(timelinesCount - 1, viewModel.EventTypesTimeline.Count()); }
public void TestClearTimeline() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); viewModel.Model = project.Timeline; viewModel.Clear(); Assert.AreEqual(0, viewModel.EventTypesTimeline.ViewModels.Count); Assert.AreEqual(0, viewModel.FullTimeline.ViewModels.Count); }
public void TestModelSetup() { var model = Utils.CreateProject(true); model.Timers.Add(new Timer()); model.Playlists.Add(new Playlist()); model.Periods.Add(new Period()); var viewModel = new DummyProjectVM { Model = model }; Assert.AreEqual(3, viewModel.Timers.Count()); Assert.AreEqual(5, viewModel.EventTypes.Count()); Assert.AreEqual(1, model.Playlists.Count()); Assert.AreEqual(1, model.Periods.Count()); }
public void CreateEventTypesTimeline_5EventTypes2WithSameNameGroupingEnabled_4TimelinesCreated() { Project project = Utils.CreateProject(true); project.EventTypes [1].Name = project.EventTypes [0].Name; ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.GroupEventsByEventTypeName = true; viewModel.CreateEventTypeTimelines(projectVM.EventTypes); Assert.AreEqual(4, viewModel.EventTypesTimeline.ViewModels.Count); }
public void TestForwardProperties() { int count = 0; var model = Utils.CreateProject(true); model.Timers.Add(new Timer()); model.Playlists.Add(new Playlist()); var viewModel = new DummyProjectVM { Model = model }; viewModel.PropertyChanged += (sender, e) => count++; model.FileSet.Add(new MediaFile()); Assert.AreNotEqual(0, count); }
public void TestSetModel() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); viewModel.Model = project.Timeline; Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count); Assert.AreEqual(3, viewModel.FullTimeline.ViewModels.Count); Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [0].Count()); Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [1].Count()); Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels [2].Count()); }
public void ModifyModel_ViewModelIsChanged() { var model = Utils.CreateProject(true); var viewModel = new DummyProjectVM { Model = model }; model.IsChanged = false; viewModel.IsChanged = false; Assert.IsFalse(viewModel.Edited); model.Timeline.Clear(); Assert.IsTrue(viewModel.Edited); Assert.IsTrue(viewModel.IsChanged); Assert.IsTrue(model.IsChanged); }
public void RemoveEventType_TimelineNotEmpty_TimelineNotRemoved() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); viewModel.Model = project.Timeline; EventType eventType = project.EventTypes [0]; project.AddEvent(eventType, new Time(0), new Time(10), new Time(5), null); var timelinesCount = viewModel.EventTypesTimeline.Count(); project.EventTypes.Remove(eventType); Assert.AreEqual(timelinesCount, viewModel.EventTypesTimeline.Count()); }
public void TestTimelineEvent() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); viewModel.Model = project.Timeline; EventType eventType = project.EventTypes [0]; Assert.AreEqual(3, viewModel.FullTimeline.ViewModels.Count); Assert.AreEqual(1, viewModel.EventTypesTimeline.ViewModels.First(e => e.EventTypeVM.Model == eventType).Count()); project.AddEvent(eventType, new Time(0), new Time(10), new Time(5), null); Assert.AreEqual(4, viewModel.FullTimeline.ViewModels.Count); Assert.AreEqual(2, viewModel.EventTypesTimeline.ViewModels.First(e => e.EventTypeVM.Model == eventType).Count()); }
public async Task SetUp() { timelineVM = new TimelineVM(); var dealer = new DummyProjectDealer(); var projectvm = new DummyProjectVM { Model = EventsFilterUtils.CreateProject() }; timelineVM.CreateEventTypeTimelines(projectvm.EventTypes); dealer.Project = projectvm; dealer.Timeline = timelineVM; eventsFilterController.SetViewModel(dealer); CreateEvents(); await eventsFilterController.Start(); }
public void SetUp() { var videoPlayerVM = new VideoPlayerVM(); Project project = Utils.CreateProject(false); project.Periods.Clear(); var period = new Period(); period.Nodes.Add(new TimeNode { Start = new Time(0), Stop = new Time(3000) }); project.Periods.Add(period); var projectVM = new DummyProjectVM { Model = project }; viewModel = new CameraSynchronizationVM { VideoPlayer = videoPlayerVM, Project = projectVM }; }
public async Task LoadedProjectPlayingChanged_SelectionChanged_ProjectNotSaved() { // Arrange await controller.Start(); DummyProjectVM firstLoadedProject = controller.ViewModel.ViewModels.First(); firstLoadedProject.IsChanged = false; firstLoadedProject.Model.IsChanged = false; controller.ViewModel.Select(firstLoadedProject); // Act controller.ViewModel.LoadedProject.Timeline.FullTimeline.FirstOrDefault().Playing = true; bool edited = controller.ViewModel.LoadedProject.Edited; controller.ViewModel.Select(controller.ViewModel.ViewModels.Skip(1).First()); // Assert Assert.IsFalse(edited); storageMock.Verify(s => s.Store(firstLoadedProject.Model, false), Times.Never()); }
public async Task SelectionChanged_WithChanges_ProjectSaved() { // Arrange await controller.Start(); DummyProjectVM firstLoadedProject = controller.ViewModel.ViewModels.First(); controller.ViewModel.Select(firstLoadedProject); controller.ViewModel.LoadedProject.ProjectType = ProjectType.URICaptureProject; // Act controller.ViewModel.Select(controller.ViewModel.ViewModels.Skip(1).First()); // Assert storageMock.Verify(s => s.Store(firstLoadedProject.Model, false), Times.Once()); Assert.AreNotEqual(firstLoadedProject, controller.ViewModel.LoadedProject); Assert.AreNotSame(firstLoadedProject.Model, controller.ViewModel.LoadedProject.Model); Assert.IsTrue(controller.ViewModel.LoadedProject.Stateful); Assert.IsFalse(firstLoadedProject.Model.IsChanged); Assert.AreEqual(ProjectType.URICaptureProject, firstLoadedProject.ProjectType); Assert.AreEqual(ProjectType.URICaptureProject, firstLoadedProject.Model.ProjectType); }
public void TestRenameEventType() { Project project = Utils.CreateProject(true); ProjectVM projectVM = new DummyProjectVM { Model = project }; TimelineVM viewModel = new TimelineVM(); viewModel.CreateEventTypeTimelines(projectVM.EventTypes); viewModel.Model = project.Timeline; string expected = "New Name"; EventType et = viewModel.Model.FirstOrDefault().EventType; et.Name = expected; viewModel.Model.Add(new TimelineEvent { EventType = et }); Assert.AreEqual(5, viewModel.EventTypesTimeline.ViewModels.Count); Assert.AreEqual(expected, viewModel.EventTypesTimeline.ViewModels.FirstOrDefault().Model.Name); }