示例#1
0
        public void WithModifiesLink(LinkField field, Page newLinkedPage)
        {
            // Act
            var modified = field.With(f => f.PageLink == new LazyLink <Page>(newLinkedPage));

            // Assert
            Assert.That(modified.PageLink.Link, Is.EqualTo(newLinkedPage));
        }
示例#2
0
        public void PreCommitWhenPropertyChangeGetsFired(GitHooks sut, ObjectRepository instance, Page page, LinkField field, Page newLinkedPage, Signature signature, string message, InMemoryBackend inMemoryBackend)
        {
            // Arrange
            CommitStartedEventArgs lastEvent = null;

            sut.CommitStarted += (_, args) => lastEvent = args;

            // Act
            instance.SaveInNewRepository(signature, message, RepositoryFixture.GetRepositoryDescription(inMemoryBackend));
            var composer = new PredicateComposer()
                           .And(field, f => f.Name == "modified field name" && f.PageLink == new LazyLink <Page>(newLinkedPage))
                           .And(page, p => p.Name == "modified page name");
            var modified = field.With(composer);

            instance.Commit(modified.Repository, signature, message);

            // Assert
            Assert.That(lastEvent, Is.Not.Null);
            Assert.That(lastEvent.Changes, Has.Count.EqualTo(2));
        }