public void GetPrivateListMembers_GarbageResults_Success() { //garbage response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "garbage result" }); List <PrivateListMember> oMembers; var res = PrivateListMember.GetPrivateListMembers(_mockServer, "objectid", "InvalidResultText", out oMembers); Assert.IsTrue(res.Success, "Calling GetPrivateListMembers with InvalidResultText should not fail:" + res); Assert.IsTrue(oMembers.Count == 0, "Invalid result text should result in empty list returned"); }
public void GetPrivateListMembers_ErrorResponse_Success() { //error response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = false, ResponseText = "error text", StatusCode = 404 }); List <PrivateListMember> oMembers; var res = PrivateListMember.GetPrivateListMembers(_mockServer, "objectid", "ErrorResponse", out oMembers); Assert.IsFalse(res.Success, "Calling GetPrivateListMembers with ErrorResponse did not fail"); Assert.IsTrue(oMembers.Count == 0, "Error result should result in empty list returned"); }
public void GetPrivateListMembers_EmptyResults_Failure() { //empty results _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "" }); List <PrivateListMember> oMembers; var res = PrivateListMember.GetPrivateListMembers(_mockServer, "objectid", "EmptyResultText", out oMembers); Assert.IsFalse(res.Success, "Calling GetPrivateListMembers with EmptyResultText did not fail"); Assert.IsTrue(oMembers.Count == 0, "Empty result text should result in empty list returned"); }