Esempio n. 1
0
        public void SnapShot_GetAllValuesMultiLevelData()
        {
            IDataContainer A = (DataContainerBase)DataContainerBuilder.Create("A")
                               .Data("A", 1)
                               .Data("B", 2)
                               .Data("C", 3)
                               .DataContainer("AB", b => b
                                              .Data("AB1", 1)
                                              .Data("AB2", 2))
                               .Build();

            SnapShot snapShot = A.GetSnapShot();

            Assert.Equal(5, snapShot.Count());
            Assert.Contains("A", snapShot.Keys);
            Assert.Contains("B", snapShot.Keys);
            Assert.Contains("C", snapShot.Keys);
            Assert.Contains("AB.AB1", snapShot.Keys);
            Assert.Contains("AB.AB2", snapShot.Keys);

            Assert.Equal(A["A"], snapShot["A"].Value);
            Assert.Equal(A["B"], snapShot["B"].Value);
            Assert.Equal(A["C"], snapShot["C"].Value);
            Assert.Equal(A["AB.AB1"], snapShot["AB.AB1"].Value);
            Assert.Equal(A["AB.AB2"], snapShot["AB.AB2"].Value);
        }
Esempio n. 2
0
        public void SnapShot_GetsAllValuesSingleLevelData()
        {
            IDataContainer A = (DataContainerBase)DataContainerBuilder.Create("A")
                               .Data("A", 1)
                               .Data("B", 2)
                               .Data("C", 3)
                               .Data("D", 4)
                               .Build();

            SnapShot snapShot = A.GetSnapShot();

            Assert.Equal(4, snapShot.Count());
            Assert.Contains("A", snapShot.Keys);
            Assert.Contains("B", snapShot.Keys);
            Assert.Contains("C", snapShot.Keys);
            Assert.Contains("D", snapShot.Keys);

            Assert.Equal(A["A"], snapShot["A"].Value);
            Assert.Equal(A["B"], snapShot["B"].Value);
            Assert.Equal(A["C"], snapShot["C"].Value);
            Assert.Equal(A["D"], snapShot["D"].Value);
        }