public void ImportLdapUser_EmptyProperties_Failure() { UserFull oUser; ConnectionPropertyList oProps = new ConnectionPropertyList(); var res = UserLdap.ImportLdapUser(_mockServer, "templatealias", "pkid", "alias", "firstname", "lastname", "extension", oProps, out oUser); Assert.IsFalse(res.Success, "Calling ImportLdapUser with empty properties should fail"); }
public void ImportLdapUser_InvalidPkid_Failure() { UserFull oUser; ConnectionPropertyList oProps = new ConnectionPropertyList(); oProps.Add("Test", "test"); var res = UserLdap.ImportLdapUser(_connectionServer, "templatealias", "pkid", "alias", "firstname", "lastname", "extension", oProps, out oUser); Assert.IsFalse(res.Success, "Calling ImportLdapUser with invalid pkid should fail"); }
public void ImportLdapUser_GarbageResults_Failure() { //garbage response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "garbage result" }); var res = UserLdap.ImportLdapUser(_mockServer, "InvalidResultText", "pkid", "Alias", "FirstName", "LastName", "Extension", null); Assert.IsTrue(res.Success, "Calling ImportLdapUser with InvalidResultText should not fail:" + res); }
public void ImportLdapUser_ReturnedObjectId_Success() { //return objectId _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "/vmrest/users/junk" }); var res = UserLdap.ImportLdapUser(_mockServer, "test", "pkid", "Alias", "FirstName", "LastName", "Extension", null); Assert.IsTrue(res.Success, "Calling ImportLdapUser with ReturnSpecificText using junk ObjectId value failed:" + res); Assert.IsTrue(res.ReturnedObjectId.Equals("junk"), "junk not returned as ObjecId of newly imported uses:" + res); }
public void ImportLdapUser_ErrorResponse_Failure() { //error response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = false, ResponseText = "error text", StatusCode = 404 }); var res = UserLdap.ImportLdapUser(_mockServer, "ErrorResponse", "pkid", "Alias", "FirstName", "LastName", "Extension", null); Assert.IsFalse(res.Success, "Calling ImportLdapUser with ErrorResponse did not fail"); }
public void ImportLdapUser_EmptyResponse_Failure() { UserFull oUser; //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 = "" }); var res = UserLdap.ImportLdapUser(_mockServer, "EmptyResultText", "pkid", "Alias", "FirstName", "LastName", "Extension", null, out oUser); Assert.IsFalse(res.Success, "Calling ImportLdapUser with EmptyResultText did not fail"); }