public void GetUser_Alias_Failure() { GlobalUser oGlobalUser; var res = GlobalUser.GetUser(out oGlobalUser, _mockServer, "", "bogus alias"); Assert.IsFalse(res.Success, "Calling GetUser with invalid alias did not fail:"); }
public void GlobalUser_GetUser() { GlobalUser oNewUser; List <GlobalUser> oUsers; WebCallResult res = GlobalUser.GetUsers(_connectionServer, out oUsers, 1, 10); Assert.IsTrue(res.Success, "Failed to fetch global users"); Assert.IsTrue(oUsers.Count > 0, "No global users returned on fetch"); //GetUser res = GlobalUser.GetUser(out oNewUser, _connectionServer, ""); Assert.IsFalse(res.Success, "Fetching user with static method with empty objectId did not fail"); res = GlobalUser.GetUser(out oNewUser, null, "bogus"); Assert.IsFalse(res.Success, "Fetching user with static method with null Connection server did not fail"); res = GlobalUser.GetUser(out oNewUser, _connectionServer, "bogus"); Assert.IsFalse(res.Success, "Fetching user with static method with invalid objectId did not fail"); res = GlobalUser.GetUser(out oNewUser, _connectionServer, oUsers[0].ObjectId); Assert.IsTrue(res.Success, "Failed to fetch a user by valid ObjectId:" + res); res = GlobalUser.GetUser(out oNewUser, _connectionServer, "", oUsers[0].Alias); Assert.IsTrue(res.Success, "Failed to fetch a user by valid Alias:" + res); }
public void GetUser_EmptyAliasAndObjectId_Failure() { GlobalUser oGlobalUser; var res = GlobalUser.GetUser(out oGlobalUser, _mockServer, ""); Assert.IsFalse(res.Success, "Calling GetUser with empty alias and ObjectId server should fail"); }
public void GetUser_NullConnectionServer_Failure() { GlobalUser oGlobalUser; var res = GlobalUser.GetUser(out oGlobalUser, null, "ObjectId", "Alias"); Assert.IsFalse(res.Success, "Calling GetUser with null Connection server should fail"); }
public void GetUser_ObjectId_Success() { Reset(); GlobalUser oGlobalUser; var res = GlobalUser.GetUser(out oGlobalUser, _mockServer, Guid.NewGuid().ToString()); Assert.IsTrue(res.Success, "Calling GetUser with objectId failed:" + res); }
public void GetUser_GarbageResult_Failure() { Reset(); //garbage response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, TotalObjectCount = 1, ResponseText = "garbage result in the response body that will not parse properly to globalUser" }); GlobalUser oUser; var res = GlobalUser.GetUser(out oUser, _mockServer, "objectid"); Assert.IsFalse(res.Success, "Calling GetUser with garbage result did not fail"); }
public void GetUser_EmptyResult_Failure() { Reset(); //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 = "" }); GlobalUser oUser; var res = GlobalUser.GetUser(out oUser, _mockServer, "objectid"); Assert.IsFalse(res.Success, "Calling GetUser with EmptyResultText did not fail"); }