示例#1
0
        public void DatasetAddSession()
        {
            var dataset = new Dataset();

            Assert.AreEqual(0, dataset.Sessions.Count);
            Assert.IsTrue(dataset.OriginatingTimeInterval.IsEmpty);

            // generate a test store
            GenerateTestStore("PsiStore", StorePath);

            // add a session
            var session0 = dataset.AddSessionFromExistingStore("Session_0", "PsiStore", StorePath);

            Assert.AreEqual(1, dataset.Sessions.Count);
            Assert.AreEqual("Session_0", dataset.Sessions[0].Name);

            // verify originating time interval
            Assert.AreEqual(session0.OriginatingTimeInterval.Left, dataset.OriginatingTimeInterval.Left);
            Assert.AreEqual(session0.OriginatingTimeInterval.Right, dataset.OriginatingTimeInterval.Right);

            // generate a new store with a different originating time interval than the first
            GenerateTestStore("NewStore", StorePath);

            // add a second session with a different name
            var session1 = dataset.AddSessionFromExistingStore("Session_1", "NewStore", StorePath);

            Assert.AreEqual(2, dataset.Sessions.Count);
            Assert.AreEqual("Session_0", dataset.Sessions[0].Name);
            Assert.AreEqual("Session_1", dataset.Sessions[1].Name);

            // verify new originating time interval
            Assert.AreEqual(session0.OriginatingTimeInterval.Left, dataset.OriginatingTimeInterval.Left);
            Assert.AreEqual(session1.OriginatingTimeInterval.Right, dataset.OriginatingTimeInterval.Right);
        }
示例#2
0
        public void DatasetRelativePaths()
        {
            var dataset = new Dataset();

            // generate a test store
            GenerateTestStore("PsiStore", StorePath);

            // add a session and assume it loaded correctly if it has a partition containing a stream
            dataset.AddSessionFromExistingStore("Session_0", "PsiStore", Path.GetFullPath(StorePath));
            Assert.IsTrue(dataset.Sessions[0].Partitions[0].AvailableStreams.Count() > 0);

            // save dataset with relative store paths
            string datasetFile = Path.Combine(StorePath, "dataset.pds");

            dataset.Save(datasetFile, true);

            // create Temp sub-folder
            var tempFolder = Path.Combine(StorePath, "Temp");

            Directory.CreateDirectory(tempFolder);

            // move both the dataset file and data stores into the sub-folder
            Directory.Move(Path.Combine(StorePath, "PsiStore.0000"), Path.Combine(tempFolder, "PsiStore.0000"));
            string newDatasetFile = Path.Combine(tempFolder, "dataset.pds");

            File.Move(datasetFile, newDatasetFile);

            // reload the saved dataset and verify that store paths are still valid
            var newDataset = Dataset.Load(newDatasetFile);

            Assert.IsTrue(newDataset.Sessions[0].Partitions[0].AvailableStreams.Count() > 0);
        }
示例#3
0
        public void DatasetAddSessionDuplicateName()
        {
            var dataset = new Dataset();

            Assert.AreEqual(0, dataset.Sessions.Count);

            // generate a test store
            GenerateTestStore("PsiStore", StorePath);

            // add a session
            var session0 = dataset.AddSessionFromExistingStore("Session_0", "PsiStore", StorePath);

            Assert.AreEqual(1, dataset.Sessions.Count);
            Assert.AreEqual("Session_0", dataset.Sessions[0].Name);

            // generate a new store with a different originating time interval than the first
            GenerateTestStore("NewStore", StorePath);

            // add a second session with a duplicate name
            var session1 = dataset.AddSessionFromExistingStore("Session_0", "NewStore", StorePath); // should throw
        }