Ejemplo n.º 1
0
        public async void TestFeatures()
        {
            IBranch branch = await Fixture.Repository.ReadBranchAsync("master");

            IBaseNode node = await branch.CreateNodeAsync(new JObject());

            List <string> featureIds = node.GetFeatureIds();

            Assert.NotEmpty(featureIds);

            JObject filenameObj = new JObject(
                new JProperty("filename", "file1")
                );
            await node.AddFeatureAsync("f:filename", filenameObj);

            featureIds = node.GetFeatureIds();
            Assert.Contains("f:filename", featureIds);
            Assert.True(node.HasFeature("f:filename"));
            JObject featureObj = node.GetFeature("f:filename");

            Assert.Equal("file1", featureObj.GetValue("filename"));

            await node.RemoveFeatureAsync("f:filename");

            featureIds = node.GetFeatureIds();
            Assert.DoesNotContain("f:filename", featureIds);
            Assert.False(node.HasFeature("f:filename"));
            Assert.Null(node.GetFeature("f:filename"));
        }