public void TrackedEntityShouldThrowExceptionOnOldVersionInsertion()
        {
            var trackable = new TestEntityTracked(TestData.InitialEntity);

            trackable.AddRevision(TestData.FirstUpdate);
            trackable.AddRevision(TestData.SecondUpdate);

            Assert.Throws <OldVersionInsertionException>(() => trackable.AddRevision(TestData.FirstUpdate));
        }
        public void TrackedEntityCanGetIntermediateVersionWhenNotExact()
        {
            var trackable = new TestEntityTracked(TestData.InitialEntity);

            trackable.AddRevision(TestData.FirstUpdate);
            trackable.AddRevision(TestData.SecondUpdate);

            Assert.Equal(null, trackable.StringProperty.GetValue(DateTime.Now.AddDays(-3).Date));
            Assert.Equal(5, trackable.IntProperty.GetValue(DateTime.Now.AddDays(-3).Date));
        }
        public void TrackedEntityCanGetLatestVersion()
        {
            var trackable = new TestEntityTracked(TestData.InitialEntity);

            trackable.AddRevision(TestData.FirstUpdate);
            trackable.AddRevision(TestData.SecondUpdate);


            Assert.Equal("Final", trackable.StringProperty.GetValue());
            Assert.Equal(5, trackable.IntProperty.GetValue());
        }
        public void TrackedEntitySupportsCollectionProperty()
        {
            var trackable = new TestEntityTracked(TestData.InitialEntity);

            trackable.AddRevision(TestData.FirstUpdate);
            trackable.AddRevision(TestData.SecondUpdate);


            Assert.True(
                trackable
                .CollectionProperty
                .GetValue(DateTime.Now.AddDays(-10).Date)
                .SequenceEqual(TestData.InitialEntity.CollectionProperty));

            Assert.Equal(null, trackable
                         .CollectionProperty
                         .GetValue(DateTime.Now.AddDays(-5).Date));

            Assert.True(
                trackable
                .CollectionProperty
                .GetValue(DateTime.Now.AddDays(-2).Date)
                .SequenceEqual(TestData.SecondUpdate.CollectionProperty));
        }