Пример #1
0
        public void Equals_EqualTimePoints_ReturnsTrue()
        {
            TimePointViewModelBase tpvmb = GetTimePointViewModel(TimePoint.GetAbsoluteTimePoint());
            var tp = tpvmb.TimePoint;

            Assert.That(tpvmb.Equals(tp));
        }
Пример #2
0
        private Preset GetTestFilledPreset()
        {
            var preset = new Preset("Test Preset");

            preset.AddTimePoint(TimePoint.GetAbsoluteTimePoint());

            return(preset);
        }
Пример #3
0
        public void IsDefaultPreset_TimePointCollectionNotEmpty_ReturnsFalse()
        {
            var preset = new Preset();

            preset.AddTimePoint(TimePoint.GetAbsoluteTimePoint());

            Assert.That(Preset.IsDefaultPreset(preset), Is.EqualTo(false));
        }
Пример #4
0
        public void AddTimePoint_ValidTimePoint_AddsTimePoint()
        {
            var preset    = new Preset();
            var timePoint = TimePoint.GetAbsoluteTimePoint();

            preset.AddTimePoint(timePoint);

            Assert.IsTrue(preset.TimePointCollection.Count > 0);
        }
Пример #5
0
        public void BaseTimeSetter_NewTimeValueWithDays_CropsTheDays(string newTimeStr)
        {
            var timePoint = TimePoint.GetAbsoluteTimePoint();
            var newTime   = TimeSpan.Parse(newTimeStr);

            timePoint.BaseTime = newTime;

            Assert.That(((TimeSpan)timePoint.BaseTime).Days == 0);
        }
Пример #6
0
        public void Equals_NotEqualTimePoints_ReturnsFalse()
        {
            TimePoint.DefaultKind = TimePointKinds.Relative;

            TimePointViewModelBase tpvmb = GetTimePointViewModel(TimePoint.GetAbsoluteTimePoint());
            var tp = TimePoint.GetAbsoluteTimePoint();

            tp.ChangeTimePointType(TimePointKinds.Absolute);

            Assert.IsFalse(tpvmb.Equals(tp));
        }
Пример #7
0
        public void AddTimePoint__IdLessThenMaximumContained__AddTimePointLikeNewTimePoint()
        {
            var timePoint = TimePoint.GetAbsoluteTimePoint();

            timePoint.ChangeTimePointType(TimePointKinds.Absolute);
            var timePointId = timePoint.Id;
            var preset      = new Preset(new[] { new TimePoint("", "0:00:00", TimePointKinds.Absolute, 1) });

            timePoint = preset.AddTimePoint(timePoint);

            Assert.AreEqual(timePointId + 2, timePoint.Id);
        }
Пример #8
0
        public void OnTimePointCollectionChanged_AddNewTimePoint_AddsTimePointViewModels()
        {
            // Arrange
            var pvm    = GetPresetViewModel();
            var preset = pvm.Preset;

            // Action
            preset.AddTimePoint(TimePoint.GetAbsoluteTimePoint());

            // Assert
            Assert.IsTrue(pvm.TimePointVmCollection.Count == 3);
        }
Пример #9
0
        public void GetDeepCopy_AfterCallThenAddTimePointToOrigin_NotSameAddedTimePointsLinks()
        {
            // Arrage:
            TimePoint[] originTimePoints = new TimePoint[] { new TimePoint("1", new TimeSpan(1, 1, 1), TimePointKinds.Relative, 1) };

            var originPreset = new Preset(originTimePoints)
            {
                PresetName = "Origin",
                StartTime  = new TimeSpan(1, 1, 1),
                Tag        = "origin"
            };


            originPreset.SetInfiniteLoop();

            // Actoin:
            var deepPreset = originPreset.GetDeepCopy();

            originPreset.AddTimePoint(TimePoint.GetAbsoluteTimePoint());

            // Assert:
            Assert.IsTrue(originPreset.TimePointCollection.Count == 2);
            Assert.IsTrue(deepPreset.TimePointCollection.Count == 1);
        }
Пример #10
0
        public void AbsoluteTimePoint_CreatedWithZeroRelativeTime()
        {
            var tp = TimePoint.GetAbsoluteTimePoint();

            Assert.That(tp.GetRelativeTime() == TimeSpan.Zero);
        }
Пример #11
0
        private TimePointViewModel GetTimePointViewModel()
        {
            TimePoint tp = TimePoint.GetAbsoluteTimePoint();

            return(new TimePointViewModel(tp, _mockPresetViewModel.Object));
        }
Пример #12
0
        public void Equals_CompareToNull_ReturnsFalse()
        {
            TimePointViewModelBase tpvmb = GetTimePointViewModel(TimePoint.GetAbsoluteTimePoint());

            Assert.IsFalse(tpvmb == null);
        }