public void ContainsRange()
        {
            var first = new DateRange(this.date1900, this.date2000);
            var second = new DateRange(this.date1950, this.date1950);

            Assert.IsTrue(first.Contains(second));
        }
        public void Map()
        {
            // Arrange
            var start = new DateTime(2010, 1, 1);
            var end = DateUtility.MaxDate;
            var range = new DateRange(start, end);

            var id = new EnergyTrading.Mdm.Contracts.MdmId { SystemName = "Test", Identifier = "A" };
            var contractDetails = new EnergyTrading.Mdm.Contracts.SourceSystemDetails();
            var contract = new EnergyTrading.Mdm.Contracts.SourceSystem
            {
                Identifiers = new EnergyTrading.Mdm.Contracts.MdmIdList { id },
                Details = contractDetails,
                MdmSystemData = new EnergyTrading.Mdm.Contracts.SystemData { StartDate = start, EndDate = end }
            };

            // NB Don't assign validity here, want to prove SUT sets it
            var details = new SourceSystem();

            var mapping = new SourceSystemMapping();

            var mappingEngine = new Mock<IMappingEngine>();
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.MdmId, SourceSystemMapping>(id)).Returns(mapping);
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.SourceSystemDetails, SourceSystem>(contractDetails)).Returns(details);

            var mapper = new SourceSystemMapper(mappingEngine.Object);

            // Act
            var candidate = mapper.Map(contract);

            // Assert
            //Assert.AreEqual(1, candidate.Details.Count, "Detail count differs");
            Assert.AreEqual(1, candidate.Mappings.Count, "Mapping count differs");
            Check(range, details.Validity, "Validity differs");
        }
        public void ChangeFinish()
        {
            var first = new DateRange(this.date1900, this.date2000);

            Assert.AreEqual(new DateRange(this.date1900, this.date1950), first.ChangeFinish(this.date1950), "ChangeFinish Date");
            Assert.AreEqual(new DateRange(this.date1900, this.date2000.AddDays(-1)), first.ChangeFinish(new TimeSpan(-1, 0, 0, 0)), "ChangeFinish TimeSpan");
        }
        public void Union()
        {
            var first = new DateRange(this.date1900, this.date1950);
            var second = new DateRange(this.date1950, this.date2000);

            Assert.AreEqual(new DateRange(this.date1900, this.date2000), first.Union(second));
        }
        public void NoOverlappingIndentifierShouldPass()
        {
            // Assert
            var start = new DateTime(1999, 1, 1);
            var finish = new DateTime(2020, 12, 31);
            var validity = new DateRange(start, finish);
            var system = new SourceSystem { Name = "Test" };
            var expectedPartyRole = new PartyRole() { PartyRoleType = "PartyRole" };
            var expected = new PartyRoleMapping { System = system, MappingValue = "1", Validity = validity, PartyRole = expectedPartyRole };
            var list = new List<PartyRoleMapping> { expected };
            var repository = new Mock<IRepository>();
            repository.Setup(x => x.Queryable<PartyRoleMapping>()).Returns(list.AsQueryable());
            repository.Setup(x => x.FindOne<PartyRole>(It.IsAny<int>())).Returns(expectedPartyRole);

            var identifier = new EnergyTrading.Mdm.Contracts.MdmId
            {
                SystemName = "Test",
                Identifier = "1",
                StartDate = start.AddHours(-10),
                EndDate = start.AddHours(-5)
            };

            var request = new CreateMappingRequest() { EntityId = 1, Mapping = identifier };
            var rule = new PartyRoleCreateMappingdNoOverlappingRule<PartyRole, PartyRoleMapping>(repository.Object);

            // Act
            var result = rule.IsValid(request);

            // Assert
            repository.Verify(x => x.FindOne<PartyRole>(It.IsAny<int>()));
            Assert.IsTrue(result, "Rule failed");
        }
        public void ChangeStart()
        {
            var first = new DateRange(this.date1900, this.date2000);

            Assert.AreEqual(new DateRange(this.date1950, this.date2000), first.ChangeStart(this.date1950), "ChangeStart Date");
            Assert.AreEqual(new DateRange(this.date1900.AddDays(-1), this.date2000), first.ChangeStart(new TimeSpan(-1, 0, 0, 0)), "ChangeStart TimeSpan");
        }
        public void OverlappingIdentifierFails()
        {
            // Assert
            var start = new DateTime(1999, 1, 1);
            var finish = new DateTime(2020, 12, 31);
            var validity = new DateRange(start, finish);
            var system = new SourceSystem { Name = "Test" };
            var expected = new SourceSystemMapping { System = system, MappingValue = "1", Validity = validity };
            var list = new System.Collections.Generic.List<SourceSystemMapping> { expected };
            var repository = new Mock<IRepository>();
            repository.Setup(x => x.Queryable<SourceSystemMapping>()).Returns(list.AsQueryable());

            var identifier = new EnergyTrading.Mdm.Contracts.MdmId
            {
                SystemName = "Test",
                Identifier = "1",
                StartDate = start.AddHours(5),
                EndDate = start.AddHours(10)
            };

            var request = new AmendMappingRequest() { EntityId = 1, Mapping = identifier, MappingId = 1 };

            var rule = new AmendMappingNoOverlappingRule<SourceSystemMapping>(repository.Object);

            // Act
            var result = rule.IsValid(request);

            // Assert
            repository.Verify(x => x.Queryable<SourceSystemMapping>());
            Assert.IsFalse(result, "Rule failed");
        }
        public void NotEquals()
        {
            var first = new DateRange(this.date1900, this.date2000);
            var second = new DateRange(this.date1900, this.date1950);

            Assert.IsTrue(first != second, "Operator inequality");
            Assert.IsFalse(first.Equals(second), "Method inequality");
        }
        public void Equals()
        {
            var first = new DateRange(this.date1900, this.date2000);
            var second = new DateRange(this.date1900, this.date2000);

            Assert.IsTrue(first == second, "Operator equality");
            Assert.IsTrue(first.Equals(second), "Method equality");
        }
        public SourceSystem()
        {
            Mappings = new List<SourceSystemMapping>();
            Validity = new DateRange();
            Timestamp = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };

            OnCreate();
        }
        public void ContainsDate()
        {
            var range = new DateRange(this.date1900, this.date2000);
            Assert.AreEqual(this.date1900, range.Start, "Start");
            Assert.AreEqual(this.date2000, range.Finish, "Finish");

            Assert.IsTrue(range.Contains(this.date1900), "1900");
            Assert.IsTrue(range.Contains(this.date1950), "1950");
            Assert.IsTrue(range.Contains(this.date2000), "2000");
        }
        public void ToContractCopiesValue()
        {
            var start = new DateTime(2011, 1, 1);
            var finish = new DateTime(2011, 12, 31);
            var value = new DateRange(start, finish);

            var candidate = value.ToContract();
            Assert.AreEqual(start, candidate.StartDate, "StartDate differs");
            Assert.AreEqual(finish, candidate.EndDate, "EndDate differs");
        }
        public void DateRangeStateComparisons()
        {
            var start = new DateTime(2009, 6, 1, 12, 0, 0);
            var finish = new DateTime(2009, 7, 1, 12, 0, 0);

            var dr = new DateRange(start, finish);

            Assert.AreEqual(DateRangeState.Current, dr.DetermineState(start.AddDays(1)), "Current");
            Assert.AreEqual(DateRangeState.Past, dr.DetermineState(start.AddDays(-1)), "Past check");
            Assert.AreEqual(DateRangeState.Future, dr.DetermineState(finish.AddDays(1)), "Future check");
        }
        public void should_return_the_min_and_max_date_of_all_party_details()
        {
            var range1 = new DateRange(DateTime.Today, DateTime.Today.AddDays(2));
            var range2 = new DateRange(DateTime.Today.AddDays(2), DateTime.Today.AddDays(4));

            var party = new Party();
            party.AddDetails(new PartyDetails() { Name = "Rob", Validity = range1 });
            party.AddDetails(new PartyDetails() { Name = "Bob", Validity = range2 });

            Assert.AreEqual(range1.Start, party.Validity.Start);
            Assert.AreEqual(range2.Finish, party.Validity.Finish);
        }
            public void should_return_the_min_and_max_date_of_all_person_details()
            {
                var range1 = new DateRange(DateTime.Today, DateTime.Today.AddDays(2));
                var range2 = new DateRange(DateTime.Today.AddDays(2), DateTime.Today.AddDays(4));

                var person = new Person();
                person.AddDetails(new PersonDetails() { FirstName = "Rob", Email = "*****@*****.**", Validity = range1 });
                person.AddDetails(new PersonDetails() { FirstName = "Bob", Email = "*****@*****.**", Validity = range2 });

                Assert.AreEqual(range1.Start, person.Validity.Start);
                Assert.AreEqual(range2.Finish, person.Validity.Finish);
            }
        public void DateRangeNotExceedingMinMax()
        {
            var oldMin = DateUtility.MinDate;
            var oldMax = DateUtility.MaxDate;

            DateUtility.SetMinDate(new DateTime(1753, 1, 1, 0, 0, 0));
            DateUtility.SetMaxDate(new DateTime(2020, 12, 31, 0, 0, 0));

            var range = new DateRange(DateTime.MinValue, DateTime.MaxValue);
            Assert.AreEqual(DateUtility.MinDate, range.Start, "Start differs");
            Assert.AreEqual(DateUtility.MaxDate, range.Finish, "Finish differs");

            DateUtility.SetMinDate(oldMin);
            DateUtility.SetMaxDate(oldMax);
        }
        public void OverlapsRangeFails()
        {
            // Assert
            var start = new DateTime(1999, 1, 1);
            var finish = new DateTime(2020, 12, 31);
            var validity = new DateRange(start, finish);
            var system = new MDM.SourceSystem { Name = "Test" };
            var counterpartyMapping = new PartyRoleMapping { System = system, MappingValue = "1", Validity = validity };

            var list = new List<PartyRoleMapping> { counterpartyMapping };
            var repository = new Mock<IRepository>();
            repository.Setup(x => x.Queryable<PartyRoleMapping>()).Returns(list.AsQueryable());

            var systemList = new List<MDM.SourceSystem>();
            var systemRepository = new Mock<IRepository>();
            systemRepository.Setup(x => x.Queryable<MDM.SourceSystem>()).Returns(systemList.AsQueryable());

            var overlapsRangeIdentifier = new EnergyTrading.Mdm.Contracts.MdmId
            {
                SystemName = "Test",
                Identifier = "1",
                StartDate = start.AddHours(10),
                EndDate = start.AddHours(15)
            };

            var identifierValidator = new NexusIdValidator<PartyRoleMapping>(repository.Object);
            var validatorEngine = new Mock<IValidatorEngine>();
            validatorEngine.Setup(x => x.IsValid(It.IsAny<EnergyTrading.Mdm.Contracts.MdmId>(), It.IsAny<IList<IRule>>()))
                          .Returns((EnergyTrading.Mdm.Contracts.MdmId x, IList<IRule> y) => identifierValidator.IsValid(x, y));
            var validator = new CounterpartyValidator(validatorEngine.Object, repository.Object);

            var counterparty = new Counterparty { Identifiers = new EnergyTrading.Mdm.Contracts.MdmIdList { overlapsRangeIdentifier } };

            // Act
            var violations = new List<IRule>();
            var result = validator.IsValid(counterparty, violations);

            // Assert
            Assert.IsFalse(result, "Validator succeeded");
        }
        public void Map()
        {
            // Arrange
            var start = new DateTime(2010, 1, 1);
            var end = DateUtility.MaxDate;
            var range = new DateRange(start, end);

            var id = new EnergyTrading.Mdm.Contracts.MdmId { SystemName = "Test", Identifier = "A" };
            var contractDetails = new EnergyTrading.MDM.Contracts.Sample.BrokerDetails();
            var contract = new EnergyTrading.MDM.Contracts.Sample.Broker
            {
                Identifiers = new EnergyTrading.Mdm.Contracts.MdmIdList { id },
                Details = contractDetails,
                MdmSystemData = new EnergyTrading.Mdm.Contracts.SystemData { StartDate = start, EndDate = end },
                Party = ObjectMother.Create<Party>().CreateNexusEntityId(() => "")
            };

            // NB Don't assign validity here, want to prove SUT sets it
            var details = new BrokerDetails();

            var mapping = new PartyRoleMapping();

            var mappingEngine = new Mock<IMappingEngine>();
            var repository = new Mock<IRepository>();
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.MdmId, PartyRoleMapping>(id)).Returns(mapping);
            mappingEngine.Setup(x => x.Map<EnergyTrading.MDM.Contracts.Sample.BrokerDetails, BrokerDetails>(contractDetails)).Returns(details);
            repository.Setup(x => x.FindOne<Party>(int.Parse(contract.Party.Identifier.Identifier))).Returns(ObjectMother.Create<Party>());

            var mapper = new BrokerMapper(mappingEngine.Object, repository.Object);

            // Act
            var candidate = mapper.Map(contract);

            // Assert
            //Assert.AreEqual(1, candidate.Details.Count, "Detail count differs");
            Assert.AreEqual(1, candidate.Mappings.Count, "Mapping count differs");
            Assert.AreEqual("Broker", candidate.PartyRoleType);
            Check(range, details.Validity, "Validity differs");
        }
        public void BadSystemFails()
        {
            // Assert
            var start = new DateTime(1999, 1, 1);
            var finish = new DateTime(2020, 12, 31);
            var validity = new DateRange(start, finish);
            var system = new SourceSystem { Name = "Test" };
            var personMapping = new PersonMapping { System = system, MappingValue = "1", Validity = validity };

            var list = new List<PersonMapping> { personMapping };
            var repository = new Mock<IRepository>();
            repository.Setup(x => x.Queryable<PersonMapping>()).Returns(list.AsQueryable());

            var badSystemIdentifier = new EnergyTrading.Mdm.Contracts.MdmId
            {
                SystemName = "Jim",
                Identifier = "1",
                StartDate = start.AddHours(-10),
                EndDate = start.AddHours(-5)
            };

            var identifierValidator = new NexusIdValidator<PersonMapping>(repository.Object);
            var validatorEngine = new Mock<IValidatorEngine>();
            validatorEngine.Setup(x => x.IsValid(It.IsAny<EnergyTrading.Mdm.Contracts.MdmId>(), It.IsAny<IList<IRule>>()))
                           .Returns((EnergyTrading.Mdm.Contracts.MdmId x, IList<IRule> y) => identifierValidator.IsValid(x, y));
            var validator = new PersonValidator(validatorEngine.Object, null);

            var person = new EnergyTrading.MDM.Contracts.Sample.Person { Identifiers = new EnergyTrading.Mdm.Contracts.MdmIdList { badSystemIdentifier } };

            // Act
            var violations = new List<IRule>();
            var result = validator.IsValid(person, violations);

            // Assert
            Assert.IsFalse(result, "Validator succeeded");
        }
        public void UnspecifiedToUtcSKeepsTime()
        {
            var start = new DateTime(2009, 6, 1, 12, 0, 0);
            var finish = new DateTime(2009, 7, 1, 12, 0, 0);

            var dr = new DateRange(start, finish, DateTimeKind.Utc);
            Assert.AreEqual(12, dr.Start.Hour, "Hour differs");
        }
Example #21
0
 /// <summary>
 /// Is the value contiguous to the original within 1 second.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public bool Contiguous(DateRange value)
 {
     return(this.Contiguous(value, new TimeSpan(0, 0, 0, 1)));
 }
Example #22
0
 /// <summary>
 /// Create a new DateRange object that represents the same period but is designated in either local or UTC time.
 /// </summary>
 /// <param name="range"></param>
 /// <param name="kind"></param>
 public static DateRange SpecifyKind(DateRange range, DateTimeKind kind)
 {
     return(new DateRange(range.start.ToUniversalTime(), range.finish.ToUniversalTime(), kind));
 }
 public static void Check(this DateRange expected, DateRange candidate)
 {
     Assert.AreEqual(expected.Start, candidate.Start, "Start differs");
     Assert.AreEqual(expected.Finish, candidate.Finish, "Finish differs");
 }
Example #24
0
 /// <summary>
 /// Is the value contiguous to the original within the specified interval
 /// </summary>
 /// <param name="value"></param>
 /// <param name="interval"></param>
 /// <returns></returns>
 public bool Contiguous(DateRange value, TimeSpan interval)
 {
     // Must be strictly after this range (to get a positive difference) and be less than the specified interval
     return(value.Start > this.Finish && (value.Start - this.Finish) < interval);
 }
        public void Disjoint()
        {
            var first = new DateRange(this.date1900, this.date1950.AddSeconds(-1));
            var second = new DateRange(this.date1950, this.date2000);

            Assert.IsTrue(first.Disjoint(second));
        }
        public void ValidDetailsSaved()
        {
            var validatorFactory = new Mock<IValidatorEngine>();
            var mappingEngine = new Mock<IMappingEngine>();
            var repository = new Mock<IRepository>();
            var searchCache = new Mock<ISearchCache>();

            // Contract
            var cd = new EnergyTrading.MDM.Contracts.Sample.CounterpartyDetails { Name = "Test" };
            var nexus = new EnergyTrading.Mdm.Contracts.SystemData { StartDate = new DateTime(2012, 1, 1) };
            var identifier = new EnergyTrading.Mdm.Contracts.MdmId { SystemName = "Test", Identifier = "A" };
            var contract = new EnergyTrading.MDM.Contracts.Sample.Counterparty { Details = cd, MdmSystemData = nexus };
            contract.Identifiers.Add(identifier);

            // Domain
            var system = new SourceSystem { Name = "Test" };
            var mapping = new PartyRoleMapping { System = system, MappingValue = "A" };
            var d1 = new CounterpartyDetails { Id = 1, Name = "Test", Timestamp = 74UL.GetVersionByteArray() };
            var entity = new Counterparty();
            entity.Party = new Party() { Id = 1};
            entity.AddDetails(d1);

            var d2 = new CounterpartyDetails { Name = "Test" };
            var range = new DateRange(new DateTime(2012, 1, 1), DateTime.MaxValue);

            validatorFactory.Setup(x => x.IsValid(It.IsAny<CreateMappingRequest>(), It.IsAny<IList<IRule>>())).Returns(true);
            validatorFactory.Setup(x => x.IsValid(It.IsAny<EnergyTrading.MDM.Contracts.Sample.Counterparty>(), It.IsAny<IList<IRule>>())).Returns(true);

            repository.Setup(x => x.FindOne<Counterparty>(1)).Returns(entity);

            mappingEngine.Setup(x => x.Map<EnergyTrading.MDM.Contracts.Sample.CounterpartyDetails, CounterpartyDetails>(cd)).Returns(d2);
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.SystemData, DateRange>(nexus)).Returns(range);
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.MdmId, PartyRoleMapping>(identifier)).Returns(mapping);

            var service = new CounterpartyService(validatorFactory.Object, mappingEngine.Object, repository.Object, searchCache.Object);

            // Act
            service.Update(1, 74, contract);

            // Assert
            Assert.AreEqual(2, entity.Details.Count, "Details count differs");
            Assert.AreEqual(1, entity.Mappings.Count, "Mapping count differs");
            repository.Verify(x => x.Save(entity));
            repository.Verify(x => x.Flush());
        }
Example #27
0
        /// <summary>
        /// Is the period wholly contained within the <see cref="DateRange" />
        /// The end points of the period are considered to be in the period.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public bool Contains(DateRange value)
        {
            if (!this.HasValue || !value.HasValue)
            {
                return false;
            }

            //value = new DateRange(value.Start, value.Finish, Kind);
            return this.Start <= value.Start && value.Finish <= this.Finish;
        }
Example #28
0
        /// <summary>
        /// Do the two periods overlap at all.
        /// </summary>
        /// <remarks>
        /// We can have both <c>!period.Disjoint(value)</c> and <c>!period.Overlaps(value)</c> if
        /// either of period or value have !HasValue.
        /// </remarks>
        /// <param name="value"></param>
        /// <returns>true if the periods overlap, false otherwise</returns>
        public bool Overlaps(DateRange value)
        {
            // NB Need to duplicate this test so we return false for !HasValue
            if (!this.HasValue || !value.HasValue)
            {
                return false;
            }

            //value = new DateRange(value.Start, value.Finish, Kind);
            return !this.Disjoint(value);
        }
Example #29
0
        /// <summary>
        /// Are the two periods entirely disjoint.
        /// </summary>
        /// <remarks>
        /// We can have both <c>!period.Disjoint(value)</c> and <c>!period.Overlaps(value)</c> if
        /// either of period or value have !HasValue.
        /// </remarks>
        /// <param name="value"></param>
        /// <returns>true if the periods do not overlap, false otherwise.</returns>
        public bool Disjoint(DateRange value)
        {
            if (!this.HasValue || !value.HasValue)
            {
                return false;
            }

            //value = new DateRange(value.Start, value.Finish, Kind);
            return value.Start > this.Finish || value.Finish < this.Start;
        }
Example #30
0
 /// <summary>
 /// Return whether the values are equal.
 /// </summary>
 /// <param name="other"></param>
 /// <returns>false if other is null, otherwise true if Start/Finish are equal, otherwise false</returns>
 public bool Equals(DateRange other)
 {
     if ((object) other == null)
     {
         return false;
     }
         
     return (this.Start == other.Start) && (this.Finish == other.Finish);
 }
        public void NotContainsRange()
        {
            var first = new DateRange(this.date1900, this.date2000);
            var second = new DateRange(this.date1900.AddDays(-1), this.date1950);

            Assert.IsFalse(first.Contains(second));
        }
        public void ValidDetailsSaved()
        {
            var validatorFactory = new Mock<IValidatorEngine>();
            var mappingEngine = new Mock<IMappingEngine>();
            var repository = new Mock<IRepository>();
            var searchCache = new Mock<ISearchCache>();

            // Contract
            var cd = new EnergyTrading.Mdm.Contracts.SourceSystemDetails();
            var nexus = new EnergyTrading.Mdm.Contracts.SystemData { StartDate = new DateTime(2012, 1, 1) };
            var identifier = new EnergyTrading.Mdm.Contracts.MdmId { SystemName = "Test", Identifier = "A" };
            var contract = new EnergyTrading.Mdm.Contracts.SourceSystem { Details = cd, MdmSystemData = nexus };
            contract.Identifiers.Add(identifier);

            // Domain
            var system = new SourceSystem { Name = "Test" };
            var mapping = new SourceSystemMapping { System = system, MappingValue = "A" };
            var d1 = ObjectMother.Create<SourceSystem>();
            d1.Id = 1;
            d1.Timestamp = 74UL.GetVersionByteArray();
            var entity = ObjectMother.Create<SourceSystem>();
            entity.Timestamp = 74UL.GetVersionByteArray();
            entity.AddDetails(d1);

            var d2 = ObjectMother.Create<SourceSystem>();
            var range = new DateRange(new DateTime(2012, 1, 1), DateTime.MaxValue);

            validatorFactory.Setup(x => x.IsValid(It.IsAny<CreateMappingRequest>(), It.IsAny<IList<IRule>>())).Returns(true);
            validatorFactory.Setup(x => x.IsValid(It.IsAny<EnergyTrading.Mdm.Contracts.SourceSystem>(), It.IsAny<IList<IRule>>())).Returns(true);

            repository.Setup(x => x.FindOne<SourceSystem>(1)).Returns(entity);

            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.SourceSystemDetails, SourceSystem>(cd)).Returns(d2);
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.SystemData, DateRange>(nexus)).Returns(range);
            mappingEngine.Setup(x => x.Map<EnergyTrading.Mdm.Contracts.MdmId, SourceSystemMapping>(identifier)).Returns(mapping);

            var service = new SourceSystemService(validatorFactory.Object, mappingEngine.Object, repository.Object, searchCache.Object);

            // Act
            service.Update(1, 74, contract);

            // Assert
            Assert.AreEqual(0, d2.Mappings.Count, "Created entity mappings count differs");
            Assert.AreEqual(0, d2.Id, "Created entity id differs");

            Assert.AreEqual(1, entity.Mappings.Count, "Mapping count differs");
            repository.Verify(x => x.Save(entity));
            repository.Verify(x => x.Flush());

            // Ok, hack the created one to align it
            d2.Id = entity.Id;
            foreach (var m in entity.Mappings)
            {
                d2.Mappings.Add(m);
            }

            // Should now be the same - avoid exposing what properties we have here
            Check(d2, entity);
        }
        public void ValueNotEqualToNull()
        {
            var start = new DateTime(2011, 1, 1);
            var finish = new DateTime(2011, 12, 31);
            var value = new DateRange(start, finish);

            Assert.IsFalse(value == null);
        }