public void CreateMetadataRoot_WithWhiteSpaceResourceName_ThrowException() { var metadataRepository = new Mock<IMetadataRepository>(); var factory = new MetadataFactory(metadataRepository.Object); factory.CreateMetadataRoot(" ", new MetadataLayer { Id = 1 }); }
public void DestroyMetadataRoot_WithMetadataNode_ThrowException() { var metadataRepository = new Mock<IMetadataRepository>(); var factory = new MetadataFactory(metadataRepository.Object); var metadataNode = new MetadataNode("MyResource"); factory.DestroyMetadataRoot(metadataNode); }
public void CreateMetadataRoot_WithValidParamters_CreatedMetadataRoot() { var metadataRepository = new Mock<IMetadataRepository>(); var factory = new MetadataFactory(metadataRepository.Object); var metadataRoot = factory.CreateMetadataRoot("MyResource", new MetadataLayer { Id = 1 }); Assert.IsNotNull(metadataRoot); Assert.AreEqual("MyResource", metadataRoot.ResourceName); }
public void CreateMetadataRoot_WithValidParamters_MetadataRootIsMadePersistent() { bool isPersistent = false; var metadataRepository = new Mock<IMetadataRepository>(); metadataRepository .Setup(x => x.MakePersistent(It.IsAny<MetadataRoot>())) .Callback(() => isPersistent = true); var factory = new MetadataFactory(metadataRepository.Object); var metadataRoot = factory.CreateMetadataRoot("MyResource", new MetadataLayer { Id = 1 }); Assert.IsTrue(isPersistent); }
public void DestroyMetadataRoot_WithValidMetadataRoot_MetadataRootIsTransient() { bool isTransient = false; var metadataRepository = new Mock<IMetadataRepository>(); metadataRepository .Setup(a => a.MakeTransient(It.IsAny<MetadataRoot>())) .Callback(() => isTransient = true); var factory = new MetadataFactory(metadataRepository.Object); var metadataRoot = new MetadataRoot("MyResource", 1); factory.DestroyMetadataRoot(metadataRoot); Assert.IsTrue(isTransient); }
public void DestroyMetadataRoot_WithNullMetadataRoot_ThrowException() { var metadataRepository = new Mock<IMetadataRepository>(); var factory = new MetadataFactory(metadataRepository.Object); factory.DestroyMetadataRoot(null); }