Пример #1
0
        public void DeleteSequenceDuringPause_NextItemSelected()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };

            var l = new CaptureSequenceList();

            l.Add(seq);

            l.Next();
            l.Next();
            l.Next();

            l.RemoveAt(l.ActiveSequenceIndex - 1);

            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
Пример #2
0
        public void GetNextSequence_ModeStandardOneDisabled_Initial()
        {
            //Arrange
            var seq  = new CaptureSequence();
            var seq2 = new CaptureSequence()
            {
                Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;
            l.Add(seq);
            l.Add(seq2);

            //Act
            var nextSeq = l.Next();

            //Assert
            Assert.AreEqual(string.Empty, l.TargetName, "Targetname");
            Assert.AreSame(seq, nextSeq);
            Assert.AreEqual(1, l.Count);
            Assert.AreSame(seq, l.ActiveSequence);
            Assert.AreEqual(1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Delay);
        }
Пример #3
0
        public void DisableSequenceDuringPause_ModeRotate_NextItemSelected()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };

            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq);

            l.Next();
            l.Next();
            l.Next();

            l.Items[l.ActiveSequenceIndex - 1].Enabled = false;

            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
Пример #4
0
        public void GetNextSequence_ModeRotateOneDisabled_FirstEmptySecondDisabledThirdSelected()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 0
            };
            var seq2 = new CaptureSequence()
            {
                ProgressExposureCount = 5, TotalExposureCount = 10, Enabled = false
            };
            var seq3 = new CaptureSequence()
            {
                ProgressExposureCount = 5, TotalExposureCount = 7
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            var actual = l.Next();

            //Assert
            Assert.AreSame(seq3, actual);
        }
Пример #5
0
        public void GetNextSequence_ModeRotate_AllFinished()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            CaptureSequence actualSeq;

            while ((actualSeq = l.Next()) != null)
            {
            }

            //Assert
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Items.Where(x => x.ProgressExposureCount <x.TotalExposureCount || x.ProgressExposureCount> x.TotalExposureCount).Count());
        }
Пример #6
0
        public void GetNextSequence_ModeRotate_NextSequenceSelected()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            var actualFirst  = l.Next();
            var actualSecond = l.Next();
            var actualThird  = l.Next();
            var actualFourth = l.Next();

            //Assert
            Assert.AreSame(seq, actualFirst, "First wrong");
            Assert.AreSame(seq2, actualSecond, "Second wrong");
            Assert.AreSame(seq3, actualThird, "Third wrong");
            Assert.AreSame(seq, actualFourth, "Fourth wrong");
        }
Пример #7
0
        public void GetNextSequence_ModeStandardOneDisabled_NextSequenceSelectedShouldBeEmpty()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 2
            };
            var seq2 = new CaptureSequence()
            {
                Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;
            l.Add(seq);
            l.Add(seq2);

            //Act
            var nextSeq = l.Next();

            nextSeq = l.Next();
            nextSeq = l.Next();

            //Assert
            Assert.AreEqual(string.Empty, l.TargetName, "Targetname");
            Assert.AreSame(null, nextSeq);
            Assert.AreEqual(1, l.Count);
            Assert.AreSame(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(0, l.Delay);
        }
Пример #8
0
        public void SequenceVM_TestInit()
        {
            profileServiceMock = new Mock <IProfileService>();
            profileServiceMock.SetupProperty(m => m.ActiveProfile.ImageFileSettings.FilePath, TestContext.CurrentContext.TestDirectory);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.SequenceSettings.TemplatePath, TestContext.CurrentContext.TestDirectory);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.AstrometrySettings.Longitude, 0);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.AstrometrySettings.Latitude, 0);
            profileServiceMock.SetupProperty(m => m.ActiveProfile.FocuserSettings.AutoFocusDisableGuiding, true);

            cameraMediatorMock            = new Mock <ICameraMediator>();
            telescopeMediatorMock         = new Mock <ITelescopeMediator>();
            focuserMediatorMock           = new Mock <IFocuserMediator>();
            filterWheelMediatorMock       = new Mock <IFilterWheelMediator>();
            guiderMediatorMock            = new Mock <IGuiderMediator>();
            rotatorMediatorMock           = new Mock <IRotatorMediator>();
            flatDeviceMediatorMock        = new Mock <IFlatDeviceMediator>();
            weatherDataMediatorMock       = new Mock <IWeatherDataMediator>();
            imagingMediatorMock           = new Mock <IImagingMediator>();
            applicationStatusMediatorMock = new Mock <IApplicationStatusMediator>();

            _dummyList = new CaptureSequenceList();
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 10
            });
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 20
            });
            _dummyList.Add(new CaptureSequence()
            {
                TotalExposureCount = 5
            });

            _flatDevice = new FlatDeviceInfo()
            {
                Brightness        = 1.0,
                Connected         = true,
                CoverState        = CoverState.Open,
                Description       = "Some description",
                DriverInfo        = "Some driverInfo",
                LightOn           = false,
                DriverVersion     = "200",
                MaxBrightness     = 255,
                MinBrightness     = 0,
                Name              = "Some name",
                SupportsOpenClose = true
            };

            _sut = new SequenceVM(profileServiceMock.Object, cameraMediatorMock.Object, telescopeMediatorMock.Object, focuserMediatorMock.Object,
                                  filterWheelMediatorMock.Object, guiderMediatorMock.Object, rotatorMediatorMock.Object, flatDeviceMediatorMock.Object,
                                  weatherDataMediatorMock.Object, imagingMediatorMock.Object, applicationStatusMediatorMock.Object);
        }
Пример #9
0
        public void AddFirstSequenceAfterOneDisabledExists_ActiveSequenceSet()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };
            var l = new CaptureSequenceList();

            l.Add(seq);
            l.Add(seq2);

            Assert.AreEqual(seq2, l.ActiveSequence);
        }
Пример #10
0
        public void RunSequenceMultipleTimes_ModeRotate_NumberOfExposuresCorrect()
        {
            var seq1 = new CaptureSequence()
            {
                TotalExposureCount = 50
            };
            var seq2 = new CaptureSequence()
            {
                TotalExposureCount = 10
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 30
            };

            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq1);

            while (l.Next() != null)
            {
            }

            l.Add(seq2);

            while (l.Next() != null)
            {
            }

            l.Add(seq3);

            while (l.Next() != null)
            {
            }

            Assert.AreEqual(50, seq1.ProgressExposureCount);
            Assert.AreEqual(10, seq2.ProgressExposureCount);
            Assert.AreEqual(30, seq3.ProgressExposureCount);
        }
Пример #11
0
        public void AddFirstSequence_ActiveSequenceSet()
        {
            var seq = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5
            };

            var l = new CaptureSequenceList();

            l.Add(seq);

            Assert.AreEqual(seq, l.ActiveSequence);
        }
Пример #12
0
        public void GetNextSequence_ModeStandardOneDisabled_AllFinished()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var seq2 = new CaptureSequence()
            {
                ProgressExposureCount = 0, TotalExposureCount = 5, Enabled = false
            };
            var seq3 = new CaptureSequence()
            {
                TotalExposureCount = 5
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.STANDARD;

            l.Add(seq);
            l.Add(seq2);
            l.Add(seq3);

            //Act
            CaptureSequence actualSeq;

            while ((actualSeq = l.Next()) != null)
            {
            }

            //Assert
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
            Assert.AreEqual(1, l.Items.Where(x => x.ProgressExposureCount < x.TotalExposureCount).Count());
            Assert.AreEqual(5, seq.ProgressExposureCount);
            Assert.AreEqual(0, seq2.ProgressExposureCount);
            Assert.AreEqual(5, seq3.ProgressExposureCount);
        }
Пример #13
0
        public void GetNextSequence_ModeRotateOneDisabled_EmptyListNextNull()
        {
            //Arrange
            var seq = new CaptureSequence()
            {
                TotalExposureCount = 5, Enabled = false
            };
            var l = new CaptureSequenceList();

            l.Mode = SequenceMode.ROTATE;
            l.Add(seq);

            //Act
            var actual = l.Next();

            //Assert
            Assert.AreSame(null, actual);
            Assert.AreEqual(null, l.ActiveSequence);
            Assert.AreEqual(-1, l.ActiveSequenceIndex);
        }