예제 #1
0
 public void AssertIsEqualTo(SomeDto dto)
 {
     NUnit.Framework.Assert.Multiple(() =>
     {
         Assert.AreEqual(Name, dto.Name);
         Assert.AreEqual(Age, dto.Age);
         Assert.AreEqual(Surname, dto.Surname);
     });
 }
예제 #2
0
        public void CreateWithContent_WriteToStream_ContentSerializedCorrect()
        {
            var content = new SomeDto()
            {
                Name    = "asdqw",
                Surname = "qqqq",
                Age     = 42
            };
            var jsonRequest = new JsonContent(content);
            var stream      = new MemoryStream();

            jsonRequest.WriteTo(stream, host: FakeUri);
            stream.Position = 0;

            var reader       = new StreamReader(stream);
            var deserialized = JsonHelper.Deserialize <SomeDto>(reader.ReadToEnd());

            content.AssertIsEqualTo(deserialized);
        }