public void DoubleLayerTreeSerializationTest() { FileCategory rootNode = new FileCategory("a"); FileCategory leftChild = new FileCategory("b"); FileCategory rightChild = new FileCategory("c"); rootNode.AddSubCategories(new FileCategory[] { leftChild, rightChild }); leftChild.AddSubCategory(new FileCategory("d")); rightChild.AddSubCategory(new FileCategory("e")); string actualJson = JsonConvert.SerializeObject(rootNode); Assert.Equal(doubleLayerTreeJson, actualJson); }
public void SimpleTreeSerializationTest() { FileCategory rootNode = new FileCategory("a"); FileCategory[] childNodes = new FileCategory[] { new FileCategory("b"), new FileCategory("c") }; rootNode.AddSubCategories(childNodes); string expectedJson = simpleTreeJson; string actualJson = JsonConvert.SerializeObject(rootNode); Assert.Equal(expectedJson, actualJson); }