public void CanInitializeAndUninitializeMultipleTimes() { var initializationEngine = new InitializationEngine(); var restrictMultipleAttributeInitialization = new RestrictMultipleAttributeInitialization(); restrictMultipleAttributeInitialization.Initialize(initializationEngine); restrictMultipleAttributeInitialization.Initialize(initializationEngine); restrictMultipleAttributeInitialization.Uninitialize(initializationEngine); restrictMultipleAttributeInitialization.Initialize(initializationEngine); restrictMultipleAttributeInitialization.Uninitialize(initializationEngine); restrictMultipleAttributeInitialization.Initialize(initializationEngine); restrictMultipleAttributeInitialization.Uninitialize(initializationEngine); restrictMultipleAttributeInitialization.Uninitialize(initializationEngine); }
public void CanNotCreateMoreThanOnePage() { var initializationEngine = new InitializationEngine(); var restrictMultipleAttributeInitialization = new RestrictMultipleAttributeInitialization(); restrictMultipleAttributeInitialization.Initialize(initializationEngine); var content = new Mock<TestPage>(); content.Setup(x => x.ContentTypeID).Returns(1); var contentLink = new ContentReference(1); var contentEventArgs = new ContentEventArgs(contentLink, content.Object); _contentEventsMock.Raise(x => x.CreatingContent += null, contentEventArgs); Assert.IsTrue(contentEventArgs.CancelAction); Assert.IsInstanceOfType(contentEventArgs.CancelReason, typeof(string)); restrictMultipleAttributeInitialization.Uninitialize(initializationEngine); }