public void MergeTwoEmptyFramesTest()
        {
            var target = new TrackingStackFrame();
            var source = new TrackingStackFrame();

            target.MergeWith(source);

            Assert.AreEqual(0, target.Count);
        }
        public void MergeEmptyFrameWithNonEmptyFrameTest()
        {
            var key    = Key.Create(Domain, typeof(MyEntity), 1);
            var target = new TrackingStackFrame();

            var source = new TrackingStackFrame();

            source.Register(CreateTrackingItem(key, TrackingItemState.Created));

            target.MergeWith(source);

            Assert.AreEqual(source.Count, target.Count);
        }
        public void MergeFramesWithDifferentItemsTest()
        {
            var key1   = Key.Create(Domain, typeof(MyEntity), 1);
            var key2   = Key.Create(Domain, typeof(MyEntity), 2);
            var target = new TrackingStackFrame();

            target.Register(CreateTrackingItem(key1, TrackingItemState.Created));

            var source = new TrackingStackFrame();

            source.Register(CreateTrackingItem(key2, TrackingItemState.Changed));
            var count = target.Count + source.Count;

            target.MergeWith(source);

            Assert.AreEqual(count, target.Count);
        }
        public void MergeFramesWithTheSameItemsTest()
        {
            var key    = Key.Create(Domain, typeof(MyEntity), 1);
            var target = new TrackingStackFrame();

            target.Register(CreateTrackingItem(key, TrackingItemState.Created));
            var count = target.Count;

            var source = new TrackingStackFrame();

            source.Register(CreateTrackingItem(key, TrackingItemState.Changed));

            target.MergeWith(source);

            Assert.AreEqual(count, target.Count);
            Assert.AreEqual(TrackingItemState.Created, target.Single().State);
        }