コード例 #1
0
        public void DatasetAppend()
        {
            var dataset = new Dataset();

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

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

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

            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);

            // create a second dataset from the new store and append it to the first
            var dataset1 = new Dataset();
            var session1 = dataset1.AddSessionFromPsiStore("NewStore", StorePath, "Session_1");

            dataset.Append(dataset1);
            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
ファイル: DatasetTests.cs プロジェクト: sandrist/psi
        public void DatasetAppendDuplicateName()
        {
            var dataset = new Dataset();
            Assert.AreEqual(0, dataset.Sessions.Count);

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

            // add a session
            dataset.AddSessionFromPsiStore("PsiStore", StorePath, "Session_0");
            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);

            // create a second dataset with a duplicate session name and append it to the first
            var dataset1 = new Dataset();
            dataset1.AddSessionFromPsiStore("NewStore", StorePath, "Session_0");

            dataset.Append(dataset1); // should throw
        }