public void Test_UserSearch_SetUID() { PasswdClient client = new PasswdClient( new PasswdClientFactory(new PasswdWebServiceConfiguration())); UserSearchBuilder builder = new UserSearchBuilder(); builder.SetUID(_userToSearchFor.UID); List <User> list = client.Search(builder.Build()); evaluate( null != list, "Test_UserSearch_SetUID", "Test_UserSearch_SetUID", "", ""); evaluate( list.Count == 1, "Test_UserSearch_SetUID: Count", "Test_UserSearch_SetUID: Count", list.Count.ToString(), "1"); evaluate( _userToSearchFor.Equals(list[0]), "Test_UserSearch_SetUID: Validate User Data", "Test_UserSearch_SetUID: Validate User Data", list[0].ToString(), _userToSearchFor.ToString()); }
public UserSearch ToUserSearch() { UserSearchBuilder builder = new UserSearchBuilder(); if (null != Name) { builder.SetName(Name); } if (null != Comment) { builder.SetComment(Comment); } if (null != Home) { builder.SetHome(Home); } if (null != Shell) { builder.SetShell(Shell); } if (null != UID) { if (uint.TryParse(UID, out uint uid)) { builder.SetUID(uid); } else { throw new HardFailureException( "The UID is limited to an unsigned integer value. " + "Please confirm that you are sending the correct values to the service " + "Recevied: " + ParameterChecker.IsNull(UID)); } } if (null != GID) { if (uint.TryParse(GID, out uint gid)) { builder.SetGID(gid); } else { throw new HardFailureException( "The GID is limited to an unsigned integer value. " + "Please confirm that you are sending the correct values to the service " + "Recevied: " + ParameterChecker.IsNull(GID)); } } return(builder.Build()); }
public void Test_UserSearchBuilder() { UserSearchBuilder builderCommentTest = new UserSearchBuilder(); evaluate( builderCommentTest.SetComment("comment") .Build() .Comment.Equals("comment"), "builderCommentTest.SetComment", "The Comment should be set", builderCommentTest.Build().Comment, "comment"); UserSearchBuilder builderGIDTest = new UserSearchBuilder(); evaluate( builderGIDTest.SetGID(99) .Build() .GID == 99, "builderGIDTest.SetGID", "The GID should be set", builderGIDTest.Build().GID.ToString(), "99"); UserSearchBuilder builderNameTest = new UserSearchBuilder(); evaluate( builderNameTest.SetName("cory wixom") .Build() .Name == "cory wixom", "builderNameTest.SetName", "The Name should be set", builderNameTest.Build().Name.ToString(), "cory wixom"); UserSearchBuilder builderUIDTest = new UserSearchBuilder(); evaluate( builderUIDTest.SetUID(89) .Build() .UID == 89, "builderUIDTest.SetUID", "The UID should be set", builderUIDTest.Build().UID.ToString(), "89"); UserSearchBuilder builderShellTest = new UserSearchBuilder(); evaluate( builderShellTest.SetShell("/shell/test") .Build() .Shell == "/shell/test", "builderShellTest.SetShell", "The Shell should be set", builderShellTest.Build().Shell.ToString(), "/shell/test"); UserSearchBuilder builderHomeTest = new UserSearchBuilder(); evaluate( builderHomeTest.SetHome("/home/test") .Build() .Home == "/home/test", "builderHomeTest.SetShell", "The Home should be set", builderHomeTest.Build().Home.ToString(), "/home/test"); }