Beispiel #1
0
        public void ItemSeenFirst_GetsUniqueId([Values(
                                                    KindOfChange.Add,
                                                    KindOfChange.Rename,
                                                    KindOfChange.Delete,
                                                    KindOfChange.Edit
                                                    )]
                                               KindOfChange kind)
        {
            var tracker = new MovementTracker();

            var previousServerPath = kind == KindOfChange.Rename ? "previous_path" : null;

            tracker.BeginChangeSet(new ChangeSet());

            var ci = new ChangeItem
            {
                ServerPath     = "current_path",
                FromServerPath = previousServerPath,
                Kind           = kind
            };

            tracker.BeginChangeSet(new ChangeSet());
            tracker.TrackId(ci);
            tracker.ApplyChangeSet(new List <ChangeItem>());

            var id = ci.Id;

            Assert.NotNull(id);
            Assert.IsTrue(Guid.TryParse(id, out var uuid)); // Is a uuid
        }
Beispiel #2
0
        private ChangeItem TrackOperation(KindOfChange kind, string currentServerPath, string previousServerPath)
        {
            // Note arg order changed here!
            var ci = new ChangeItem
            {
                ServerPath     = currentServerPath,
                FromServerPath = previousServerPath,
                Kind           = kind
            };

            _currentChangeSet.Items.Add(ci);

            _tracker.TrackId(ci);
            return(ci);
        }