Пример #1
0
        public void SchedulesWithEqualValuesAreEqual()
        {
            // Arrange.
            var pattern1 = Mock.Create<ISchedulePattern>(Behavior.CallOriginal);
            var pattern2 = Mock.Create<ISchedulePattern>(Behavior.CallOriginal);
            Mock.Arrange(() => pattern1.Equals(pattern2)).Returns(true);
            Mock.Arrange(() => pattern2.Equals(pattern1)).Returns(true);

            var frequency1 = Mock.Create<IScheduleDailyFrequency>(Behavior.CallOriginal);
            var frequency2 = Mock.Create<IScheduleDailyFrequency>(Behavior.CallOriginal);
            Mock.Arrange(() => frequency1.Equals(frequency2)).Returns(true);
            Mock.Arrange(() => frequency2.Equals(frequency1)).Returns(true);

            var target = new Schedule
                             {
                                 Guid = Guid.Parse("{FFBE399A-F417-487B-BC2B-1D1B2CBDF578}"),
                                 Name = "Schedule",
                                 Description = "Description",
                                 IsActive = true,
                                 StartDate = new DateTime(2013, 1, 16),
                                 EndDate = new DateTime(2013, 1, 17),
                                 Pattern = pattern1,
                                 DailyFrequency = frequency1
                             };

            var other = new Schedule
                            {
                                Guid = Guid.Parse("{FFBE399A-F417-487B-BC2B-1D1B2CBDF578}"),
                                Name = "Schedule",
                                Description = "Description",
                                IsActive = true,
                                StartDate = new DateTime(2013, 1, 16),
                                EndDate = new DateTime(2013, 1, 17),
                                Pattern = pattern2,
                                DailyFrequency = frequency2
                            };

            // Assert.
            Assert.IsTrue(target.Equals(other));
        }
Пример #2
0
        public void SchedulesWithDifferentPatternAreNotEqual()
        {
            var pattern1 = Mock.Create<ISchedulePattern>(Behavior.CallOriginal);
            var pattern2 = Mock.Create<ISchedulePattern>(Behavior.CallOriginal);

            Mock.Arrange(() => pattern1.Equals(pattern2)).Returns(false);
            Mock.Arrange(() => pattern2.Equals(pattern1)).Returns(false);

            var target = new Schedule { Pattern = pattern1 };
            var other = new Schedule { Pattern = pattern2 };
            Assert.IsFalse(target.Equals(other));
        }
Пример #3
0
        public void SchedulesWithDifferentDailyFrequencyAreNotEqual()
        {
            var frequency1 = Mock.Create<IScheduleDailyFrequency>(Behavior.CallOriginal);
            var frequency2 = Mock.Create<IScheduleDailyFrequency>(Behavior.CallOriginal);

            Mock.Arrange(() => frequency1.Equals(frequency2)).Returns(false);
            Mock.Arrange(() => frequency2.Equals(frequency1)).Returns(false);

            var target = new Schedule { DailyFrequency = frequency1 };
            var other = new Schedule { DailyFrequency = frequency2 };
            Assert.IsFalse(target.Equals(other));
        }
Пример #4
0
 public void SchedulesWithDifferentIsActiveAreNotEqual()
 {
     var target = new Schedule { IsActive = false };
     var other = new Schedule { IsActive = true };
     Assert.IsFalse(target.Equals(other));
 }
Пример #5
0
 public void SchedulesWithDifferentEndDateAreNotEqual()
 {
     var target = new Schedule { EndDate = new DateTime(2013, 1, 16) };
     var other = new Schedule { EndDate = new DateTime(2013, 1, 17) };
     Assert.IsFalse(target.Equals(other));
 }
Пример #6
0
 public void SchedulesWithDifferentNameAreNotEqual()
 {
     var target = new Schedule { Name = "Schedule 1" };
     var other = new Schedule { Name = "Schedule 2" };
     Assert.IsFalse(target.Equals(other));
 }
Пример #7
0
 public void SchedulesWithDifferentDescriptionAreNotEqual()
 {
     var target = new Schedule { Description = "Description 1" };
     var other = new Schedule { Description = "Description 2" };
     Assert.IsFalse(target.Equals(other));
 }
Пример #8
0
 public void SchedulesWithDifferentGuidAreNotEqual()
 {
     var target = new Schedule { Guid = Guid.Parse("{0986C289-50E9-4FBC-AF11-C6BCBDE87276}") };
     var other = new Schedule { Guid = Guid.Parse("{FF1E204E-9820-4B00-ABFD-52CAD2D3487B}") };
     Assert.IsFalse(target.Equals(other));
 }
Пример #9
0
 public void SchedulesWithDefaultValuesAreEqual()
 {
     var target = new Schedule();
     var other = new Schedule();
     Assert.IsTrue(target.Equals(other));
 }
Пример #10
0
 public void ScheduleIsNotEqualToRandomObject()
 {
     var target = new Schedule();
     Assert.IsFalse(target.Equals(new object()));
 }
Пример #11
0
 public void ScheduleIsEqualToSelf()
 {
     var target = new Schedule();
     Assert.IsTrue(target.Equals(target));
 }
Пример #12
0
 public void ScheduleIsNotEqualToNull()
 {
     var target = new Schedule();
     Assert.IsFalse(target.Equals(null));
 }