示例#1
0
        public void DeleteObject([Values(true, false)] bool allVersions, [Values(true, false)] bool withSession)
        {
            var session = new MockedSession(new MockedRepository().Object.Id);
            var contentChangeHandler = new Mock <ContentChangeEventHandler>();
            var underTest            = new MockedDocument("name", "content")
            {
                MockedSession = withSession ? session : null
            };

            session.Objects.Add(underTest.Object.Id, underTest.Object);
            underTest.ContentChanged += contentChangeHandler.Object;

            underTest.Object.Delete(allVersions);

            Assert.That(session.Objects, withSession ? Is.Empty : Is.Not.Empty);
            contentChangeHandler.Verify(h => h(underTest, It.Is <IChangeEvent>(e => e.ChangeType == ChangeType.Deleted && e.ObjectId == underTest.Object.Id)), Times.Once());
        }
        public void DeleteObject([Values(true, false)]bool allVersions, [Values(true, false)]bool withSession) {
            var session = new MockedSession(new MockedRepository().Object.Id);
            var contentChangeHandler = new Mock<ContentChangeEventHandler>();
            var underTest = new MockedDocument("name", "content") { MockedSession = withSession ? session : null };
            session.Objects.Add(underTest.Object.Id, underTest.Object);
            underTest.ContentChanged += contentChangeHandler.Object;

            underTest.Object.Delete(allVersions);

            Assert.That(session.Objects, withSession ? Is.Empty : Is.Not.Empty);
            contentChangeHandler.Verify(h => h(underTest, It.Is<IChangeEvent>(e => e.ChangeType == ChangeType.Deleted && e.ObjectId == underTest.Object.Id)), Times.Once());
        }