Exemple #1
0
        public void ThenItSetReadDateOfLineageEntriesToSpecifiedDate(UnitTestEntity entity, DateTime readDate)
        {
            entity.SetLineageForRequestedFields(readDate);

            foreach (var key in entity._Lineage.Keys)
            {
                var actual = entity._Lineage[key];
                Assert.AreEqual(readDate, actual.ReadDate,
                                $"Expected ReadDate of {readDate} for {key} but received {actual.ReadDate}");
            }
        }
Exemple #2
0
        public void ThenItSetReadDateOfLineageEntriesToUtcNowIfNoDateSpecified(UnitTestEntity entity)
        {
            entity.SetLineageForRequestedFields();

            var expected = DateTime.UtcNow;

            foreach (var key in entity._Lineage.Keys)
            {
                var actual = entity._Lineage[key];
                Assert.AreEqual(expected.Ticks, actual.ReadDate.Value.Ticks, 1000,
                                $"Expected ReadDate of {expected} +/- 1000 ticks for {key} but received {actual.ReadDate}");
            }
        }
Exemple #3
0
        public void ThenItShouldNotIncludeLineageForPropertiesOfTheyEntityBase()
        {
            var entity = new UnitTestEntity
            {
                StringField = "hello",
                IntField    = 1,
                LongField   = 99,
                SubEntity   = new UnitTestSubEntity(),
            };

            entity.SetLineageForRequestedFields();

            Assert.IsFalse(entity._Lineage.ContainsKey("SubEntity"));
        }
Exemple #4
0
        public void ThenItShouldIncludeLineageForAllPropertiesThatAreNotNull()
        {
            var entity = new UnitTestEntity
            {
                StringField = "hello",
                IntField    = 1,
                LongField   = 99,
            };

            entity.SetLineageForRequestedFields();

            Assert.IsNotNull(entity._Lineage);
            Assert.AreEqual(3, entity._Lineage.Count);
            Assert.IsTrue(entity._Lineage.ContainsKey("StringField"));
            Assert.IsTrue(entity._Lineage.ContainsKey("IntField"));
            Assert.IsTrue(entity._Lineage.ContainsKey("LongField"));
        }