public void IsReferencedTest_NonReferenced_ReturnFalse() { var mockObject = new MockDto("TestValue"); var serverReferenceResolver = new ServerReferenceResolver(); Assert.IsFalse(serverReferenceResolver.IsReferenced(this, mockObject)); }
public void IsReferencedTest_Referenced_ReturnTrue() { var mockObject = new MockDto("TestValue"); var serverReferenceResolver = new ServerReferenceResolver(); serverReferenceResolver.GetReference(this, mockObject); Assert.IsTrue(serverReferenceResolver.IsReferenced(this, mockObject)); }
public async Task Serializes_Object(MockDto dto) { var serializer = new JsonHttpContentSerializer(); var serialized = serializer.Serialize(dto, encoding: null); var str = await serialized.ReadAsStringAsync(); var expected = JsonConvert.SerializeObject(dto); str.Should().Be(expected); }
public async Task Serializes_Object_And_Sets_Content(MockDto dto) { var builder = new HttpRequestMessageBuilder(); var expectedContent = DefaultSerializer.Serialize(dto, DefaultEncoding); var actualContent = builder.SetJsonContent(dto).HttpRequestMessage.Content; var expectedString = await expectedContent.ReadAsStringAsync(); var actualString = await actualContent.ReadAsStringAsync(); actualString.Should().Be(expectedString); }
public void InvokeCtor() { var dto = new MockDto { A = 1, B = 2, C = 3 }; @class = InvokeUtil.InvokeCtor<MockClass,MockDto>(dto); Assert.That(@class.A,Is.EqualTo(dto.A)); }
public void InvokeCtor() { var dto = new MockDto { A = 1, B = 2, C = 3 }; @class = InvokeUtil.InvokeCtor <MockClass, MockDto>(dto); Assert.That(@class.A, Is.EqualTo(dto.A)); }
public void ResolveReferenceTest_NonReferenced_ReturnDto() { var serverReferenceResolver = new ServerReferenceResolver(); PrivateObject po = new PrivateObject(serverReferenceResolver); var mockObject = new MockDto("TestValue"); var _knownDtos = ((Dictionary <Guid, ServerObjectBase>)po.GetField("_knownDtos")); var _knownDtosCount = _knownDtos.Count; var stringGuid = serverReferenceResolver.GetReference(this, mockObject); var dto = serverReferenceResolver.ResolveReference(new Guid(stringGuid)); Assert.IsNotNull(dto); Assert.AreEqual(_knownDtosCount + 1, _knownDtos.Count); }