public void when_forking_an_object_with_a_single_child() { //setup var visitor = new FindAndCopyVersioningChildVisitor(); var parent = _testHelper.MakeVersioning<DeepPropertyBag>().GetVersionControlNode(); var givenChild = _testHelper.MakeVersioning<DeepPropertyBag>(parent); var swappedChild = _testHelper.MakeVersioning<DeepPropertyBag>(); A.CallTo(() => givenChild.GetVersionControlNode().CurrentDepthCopy()).Returns(swappedChild); var givenMutation = new TimestampedPropertyVersionDelta(givenChild, TestHelper.DeepNestedVersioner.SetMethod, 1L); parent.Mutations.Add(givenMutation); //act parent.Accept(visitor); //assert parent.Children.Should().NotIntersectWith(new[] {givenChild.GetVersionControlNode(), parent}); parent.Children.Should().ContainSingle(actualChild => ReferenceEquals(actualChild, swappedChild.GetVersionControlNode())); parent.Mutations.Single().Should().NotBeSameAs(givenMutation); A.CallTo(() => givenChild.GetVersionControlNode().CurrentDepthCopy()) .MustHaveHappened(Repeated.Exactly.Once); A.CallTo(() => swappedChild.GetVersionControlNode().RecursiveAccept(null)) .WhenArgumentsMatch(args => args.Single() is FindAndCopyVersioningChildVisitor) .MustHaveHappened(Repeated.Exactly.Once); }
public TimestampedPropertyVersionDelta(TimestampedPropertyVersionDelta delta) : base(delta) { }
public TimestampedPropertyVersionDelta(TimestampedPropertyVersionDelta delta, object newSetValue) : base(delta, new[]{newSetValue}) { }
private static bool calledWithBaseObjectAndChangeSet(ArgumentCollection args, FlatPropertyBag baseObject, TimestampedPropertyVersionDelta versionDelta) { var correct = args.Get<IVersionControlNode>(ExistingControllerArgumentName).Mutations.Single().Equals(versionDelta); correct &= args.Get<FlatPropertyBag>(ExistingObjectArgumentName).Equals(baseObject); return correct; }
private IVersionControlledObject MakeChildAndAssociativeMutationTo(DeepPropertyBag parent) { if (parent == null || ! parent.IsUnderVersionCommand()) throw new ArgumentException("Must be not null and versioning object.", "parent"); var existingNode = parent.GetVersionControlNode(); var child = _testHelper.MakeVersioning<DeepPropertyBag>(existingNode); var addChildToParent = new TimestampedPropertyVersionDelta(child, TestHelper.DeepNestedVersioner.SetMethod, _lastVersionNumber++); parent.GetVersionControlNode().Mutations.Add(addChildToParent); return child; }
public TimestampedPropertyVersionDelta(TimestampedPropertyVersionDelta delta) : base(delta) { }
public TimestampedPropertyVersionDelta(TimestampedPropertyVersionDelta delta, object newSetValue) : base(delta, new[] { newSetValue }) { }