Esempio n. 1
0
        public void Remove_Test()
        {
            ServiceIdentityTree tree = this.SetupTree();

            // Delete a node
            tree.Remove(this.e2_L1.Id).Wait();

            // Auth-chains for everything in its subtree should be invalidated
            Assert.False(tree.GetAuthChain(this.e2_L1.Id).Result.HasValue);
            Assert.False(tree.GetAuthChain(this.e3_L2.Id).Result.HasValue);
            Assert.False(tree.GetAuthChain(this.e4_L2.Id).Result.HasValue);
            Assert.False(tree.GetAuthChain(this.leaf2.Id).Result.HasValue);
            Assert.False(tree.GetAuthChain(this.mod2.Id).Result.HasValue);

            // Delete the rest of the subtree
            tree.Remove(this.e3_L2.Id).Wait();
            tree.Remove(this.e4_L2.Id).Wait();
            tree.Remove(this.leaf2.Id).Wait();
            tree.Remove(this.mod2.Id).Wait();

            // Nothing under e2_L1 should remain
            Assert.False(tree.Get(this.e2_L1.Id).Result.HasValue);
            Assert.False(tree.Get(this.e3_L2.Id).Result.HasValue);
            Assert.False(tree.Get(this.e4_L2.Id).Result.HasValue);
            Assert.False(tree.Get(this.leaf2.Id).Result.HasValue);
            Assert.False(tree.Get(this.mod2.Id).Result.HasValue);
        }