public void AddChild()
        {
            DatasetCreationInformation creationInformation = null;

            var storage = new Mock <IPersistenceInformation>();
            var child   = CreateMockDataset();
            var dataset = new Mock <IProxyDataset>();
            {
                dataset.Setup(d => d.StoredAt)
                .Returns(storage.Object);

                dataset.Setup(d => d.CreateNewChild(It.IsAny <DatasetCreationInformation>()))
                .Callback <DatasetCreationInformation>(d => creationInformation = d)
                .Returns(child);
            }

            var facade      = new ScriptBackEndDatasetFacade(new DatasetFacade(dataset.Object));
            var childFacade = facade.AddChild();

            Assert.AreEqual(new ScriptBackEndDatasetFacade(new DatasetFacade(child)), childFacade);
            Assert.IsFalse(creationInformation.CanBeAdopted);
            Assert.IsTrue(creationInformation.CanBecomeParent);
            Assert.IsTrue(creationInformation.CanBeCopied);
            Assert.IsTrue(creationInformation.CanBeDeleted);
            Assert.AreEqual(DatasetCreator.User, creationInformation.CreatedOnRequestOf);
            Assert.AreEqual(storage.Object, creationInformation.LoadFrom);
        }
Пример #2
0
 /// <summary>
 /// Adds a new child.
 /// </summary>
 /// <returns>
 /// The newly created dataset.
 /// </returns>
 public IDatasetScriptFacade AddChild()
 {
     return(new ScriptFrontEndDatasetFacade(m_Dataset.AddChild()));
 }