public void Tests() { var reader = new JSectionReader(); var actual = reader.Read("TablePartOfArrayTests.json").GetSection("node1", 1).GetTable(typeof(int), typeof(int)); var expected = reader.Read("TablePartOfArrayTests.json").GetSection("node2").GetTable(typeof(int), typeof(int)); actual.Should().BeEquivalentTo(expected); }
public void Test(string searchPath, Type[] tableTypes, List <List <object> > expected) { var reader = new JSectionReader(); var actual = reader.Read("TableDataTests.json").GetSection(searchPath) .GetTable(tableTypes); actual.Should().BeEquivalentTo(expected); }
public void Test(string testCaseName, object[] initialFilter, object[] later1Filter, object[] later2Filter) { var reader = new JSectionReader(); var actual = reader.Read("NarrowingSectionsTests.json", Encoding.Default, initialFilter).GetSection(later1Filter).GetSection(later2Filter) .GetTable(typeof(int), typeof(string)); actual.Should().BeEquivalentTo(GetExpected()); }
public static Exception GetExceptionAttemptingToGetJsonSegment(string file, params object[] tokens) { try { var reader = new JSectionReader(); reader.Read(file).GetSection(tokens); } catch (Exception e) { return(e); } throw new Exception(); }
public void Tests(string segment, Type exceptionType, string errorMessage, params Type[] tableTypes) { Exception GetExceptionInTable() { try { var reader = new JSectionReader(); var table = reader.Read("TableAccessErrorTests.json").GetSection(segment).GetTable(tableTypes); } catch (Exception e) { return(e); } throw new Exception("no exception"); } var exception = GetExceptionInTable(); Assert.AreEqual(exceptionType, exception.GetType()); Assert.AreEqual(errorMessage, exception.Message); }