public void IsReferencedTest_NonReferenced_ReturnFalse() { var mockObject = new MockDto("TestValue"); var serverReferenceResolver = new ServerReferenceResolver(); Assert.IsFalse(serverReferenceResolver.IsReferenced(this, mockObject)); }
public void ResolveReferenceTest_UnknownGuid_ReturnNull() { var serverReferenceResolver = new ServerReferenceResolver(); var dto = serverReferenceResolver.ResolveReference(new Guid()); Assert.IsNull(dto, "dto not null!"); }
public void IsReferencedTest_NonDto_ReturnGuidEmpty() { var obj = new object(); var serverReferenceResolver = new ServerReferenceResolver(); var result = serverReferenceResolver.IsReferenced(this, obj); Assert.AreEqual(result, Guid.Empty); }
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 void GetReferenceTest_NonDtoObject_ReturnEmpty() { var mockObject = new object(); var serverReferenceResolver = new ServerReferenceResolver(); var result = serverReferenceResolver.GetReference(this, mockObject); Assert.AreEqual(result, String.Empty, ""); }
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); }