public void ConverterReadWrongPathTest() { var reader = CreateTestReader(); var converter = new JsonListResponseConverter <TestResponse>("actions"); converter.CanRead.ShouldBeTrue(); var emptyResult = converter.ReadJson(reader, typeof(TestResponse), new List <TestResponse>(), false, new JsonSerializer()); emptyResult.ShouldBeEmpty(); }
public void ConverterReadTest() { var reader = CreateTestReader(); var converter = new JsonListResponseConverter <TestResponse>("plans.plan"); converter.CanRead.ShouldBeTrue(); var result = converter.ReadJson(reader, typeof(TestResponse), new List <TestResponse>(), false, new JsonSerializer()); result.ShouldNotBeNull(); result.Select(r => r.Name).ShouldBe(new[] { "READ", "WRITE" }); }
public void ConverterWriteTest() { var memoryStream = new MemoryStream(); var streamWriter = new StreamWriter(memoryStream); var writer = new JsonTextWriter(streamWriter); var converter = new JsonListResponseConverter <TestResponse>("test"); converter.CanWrite.ShouldBeFalse(); converter.WriteJson(writer, new List <TestResponse>(), new JsonSerializer()); memoryStream.Length.ShouldBe(0); }