public async Task UpdateBirthday_Generates_StrictJson() { UpdateUser user = new UpdateUser() { Kudos = new UpdateKudosExtension() { DateOfBirth = new DateTime(2016, 1, 2) } }; const string expected = @"{""schemas"":[""urn:scim:schemas:core:1.0"",""urn:scim:schemas:extension:kudos:1.0""],""urn:scim:schemas:extension:kudos:1.0"":{""dateOfBirth"":""2016-01-02T00:00:00""}}"; KudosApi kudos = new KudosApi(null, Helpers.PrepareHttpClient(String.Empty)); await kudos.UpdateUserAsync(53792, user); Assert.AreEqual(expected, kudos.LastStringContent); }
public async Task UpdateUserNameAndName_Generates_StrictJson() { UpdateUser user = new UpdateUser() { UserName = "******", Name = new UserName() { GivenName = "Smith", FamilyName = "Barbara" } }; string expected = String.Format(@"{{""schemas"":[""urn:scim:schemas:core:1.0""],""userName"":""{0}"",""name"":{{""givenName"":""{1}"",""familyName"":""{2}""}}}}", user.UserName, user.Name.GivenName, user.Name.FamilyName); KudosApi kudos = new KudosApi(null, Helpers.PrepareHttpClient(String.Empty)); await kudos.UpdateUserAsync(53792, user); Assert.AreEqual(expected, kudos.LastStringContent); }
private static async Task UserEndpoint(IKudosApi kudos) { UserSchema schema = await kudos.GetUserSchemaAsync(); Console.WriteLine(schema.Description); Users users = await kudos.GetUsersAsync(); foreach (User u in users.Resources) { Console.WriteLine("{0} {1} {2}", u.Name.GivenName, u.Name.FamilyName, u.Id); } User user = await kudos.GetUserAsync(42); Console.WriteLine("{0} {1} in {2}, Born {3}", user.Name.GivenName, user.Name.FamilyName, user.Enterprise.Department, user.Kudos.DateOfBirth.ToShortDateString()); UpdateUser update = new UpdateUser() { Kudos = new Kudos.Models.Extensions.UpdateKudosExtension() { DateOfBirth = new DateTime(1953, 1, 20) } }; User result = await kudos.UpdateUserAsync(42, update); Console.WriteLine("{0} {1} in {2}, born {3}", result.Name.GivenName, result.Name.FamilyName, result.Enterprise.Department, result.Kudos.DateOfBirth.ToShortDateString()); User newUser = new User() { UserName = "******" }; User response = await kudos.CreateUserAsync(newUser); Console.WriteLine("User ID {0} created for {1}", response.Id, response.UserName); await kudos.DeleteUserAsync(42); }