public void Constructor_Normal_DiagnoseOutputViewModelsNotNull()
 {
     var mock = new Mock<IDiagnoseOutputEntry>();
     mock.Setup(x => x.Type).Returns(DiagnoseType.SingleOutput);
     mock.Setup(x => x.Duration).Returns(1);
     mock.Setup(x => x.Gap).Returns(2);
     var threadViewModel = new ThreadViewModel(mock.Object, 0);
     threadViewModel.DiagnoseOutputViewModels.Should().NotBeNull();
 }
        public void ProcessNewDiagnoseOutputEntry_NewEntryStartBracketOutput_IsBracketOpen()
        {
            var mock = new Mock<IDiagnoseOutputEntry>();
            mock.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock.Setup(x => x.Duration).Returns(1);
            mock.Setup(x => x.Gap).Returns(2);

            var threadViewModel = new ThreadViewModel(mock.Object, 0);

            threadViewModel.DiagnoseOutputViewModels[0].IsBracketOpen.Should().Be(true);
        }
        public void ProcessNewDiagnoseOutputEntry_NewEntryWithLastAddedEntryIsBracketOpen_AddsDurationAndGapToTotalThreadViewModelDuration()
        {
            var mock = new Mock<IDiagnoseOutputEntry>();
            mock.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock.Setup(x => x.Duration).Returns(1);
            mock.Setup(x => x.Gap).Returns(2);

            var threadViewModel = new ThreadViewModel(mock.Object, 0);
            threadViewModel.ProcessNewDiagnoseOutputEntry(mock.Object);

            threadViewModel.TotalDuration.Should().Be(6);
        }
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry diagnoseOutputEntry)
        {
            var thread = Threads.SingleOrDefault(x => x.ThreadNumber == diagnoseOutputEntry.ThreadNumber);

            if (thread == null)
            {
                thread = new ThreadViewModel(diagnoseOutputEntry, TotalDuration);
                Threads.Add(thread);
            }
            else
            {
                thread.ProcessNewDiagnoseOutputEntry(diagnoseOutputEntry);
            }

            TotalDuration = thread.TotalDuration;
        }
        public void ProcessNewDiagnoseOutputEntry(IDiagnoseOutputEntry diagnoseOutputEntry)
        {
            var thread = Threads.SingleOrDefault(x => x.ThreadNumber == diagnoseOutputEntry.ThreadNumber);

            if (thread == null)
            {
                thread = new ThreadViewModel(diagnoseOutputEntry, TotalDuration);
                Threads.Add(thread);
            }
            else
            {
                thread.ProcessNewDiagnoseOutputEntry(diagnoseOutputEntry);
            }

            TotalDuration = thread.TotalDuration;
        }
        public void ProcessNewDiagnoseOutputEntry_NewEntryWithLastAddedEntryIsBracketOpen_AddsToLastEntry()
        {
            var mock = new Mock<IDiagnoseOutputEntry>();
            mock.Setup(x => x.Type).Returns(DiagnoseType.StartBracketOutput);
            mock.Setup(x => x.Duration).Returns(1);
            mock.Setup(x => x.Gap).Returns(2);

            var threadViewModel = new ThreadViewModel(mock.Object, 0);
            threadViewModel.ProcessNewDiagnoseOutputEntry(mock.Object);

            threadViewModel.DiagnoseOutputViewModels.Should().HaveCount(1);
            threadViewModel.DiagnoseOutputViewModels[0].DiagnoseOutputViewModels.Should().HaveCount(1);
        }