JsonFileTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Content.Json.Tests JsonFileTests

Namespace: DeltaEngine.Content.Json.Tests
Assembly: DeltaEngine.Content.Json.Tests (in DeltaEngine.Content.Json.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class JsonFileTests

The JsonFileTests type exposes the following members.

Constructors

  NameDescription
Public methodJsonFileTests
Initializes a new instance of the JsonFileTests class
Top
Methods

  NameDescription
Public methodCreateFileToLoad
Public methodLoadingJsonWithoutFileIsNotAllowed
Public methodLoadingNonexistingFileIsNotAllowed
Public methodLoadNodeFromTestJson
Public methodTestJsonHasOneNode
Top
Examples

[Test]
public void LoadNodeFromTestJson()
{
    var file = new JsonFile(TestFilename);
    Assert.AreEqual(6, file.Root.Get<int>("SomeData"));
}
[Test]
public void TestJsonHasOneNode()
{
    var file = new JsonFile(TestFilename);
    Assert.AreEqual(1, file.Root.NumberOfNodes);
}
[Test]
public void LoadingJsonWithoutFileIsNotAllowed()
{
    Assert.Throws<JsonFile.FileNotFound>(() => new JsonFile(null));
    Assert.Throws<JsonFile.FileNotFound>(() => new JsonFile(""));
}
[Test]
public void LoadingNonexistingFileIsNotAllowed()
{
    Assert.Throws<JsonFile.FileNotFound>(() => new JsonFile("NonExistingFile.json"));
}
See Also