public void CreateRandomPage_DoesNot_CreatesWhenModulus2IsZero() { Mock <IDateTime> dateMock = new Mock <IDateTime>(); dateMock.SetupGet(i => i.Now).Returns(new DateTime(2000, 1, 1)); Mock <IContentRepository> mock = new Mock <IContentRepository>(); mock.Setup(i => i.GetDefault <TestPage>(It.IsAny <PageReference>())).Returns(new TestPage()); var p = new PageReference(5); var t = p.CreateRandomPage <TestPage>(dateMock.Object, mock.Object); mock.Verify(i => i.Save(It.IsAny <IContent>(), SaveAction.Publish, AccessLevel.NoAccess), Times.Never); }