public void Execute_ComplexObject_NoParamsTest() { ApplicationClient userSvc = new ApplicationClient(UserId, ApiKey, "UserService"); User expected = new User(2, new FullName("Jane", "Doe")); User actual = userSvc.Execute<User>("CreateDefault"); Assert.IsNotNull(actual); Assert.AreEqual(expected.Id, actual.Id); Assert.IsNotNull(actual.Name); Assert.AreEqual(expected.Name.FirstName, actual.Name.FirstName); Assert.AreEqual(expected.Name.LastName, actual.Name.LastName); }
public void Execute_ComplexObject_withParamsTest() { ApplicationClient userSvc = new ApplicationClient(UserId, ApiKey, "UserService"); User expected = new User(1, new FullName("Alex", "Espinoza")); User actual = userSvc.Execute<User>("Create", new MethodParameter("id", expected.Id), new MethodParameter("name", expected.Name)); Assert.IsNotNull(actual); Assert.AreEqual(expected.Id, actual.Id); Assert.IsNotNull(actual.Name); Assert.AreEqual(expected.Name.FirstName, actual.Name.FirstName); Assert.AreEqual(expected.Name.LastName, actual.Name.LastName); }
public void ExecuteAsync_ComplexObject_withParamsTest() { ApplicationClient userSvc = new ApplicationClient(UserId, ApiKey, "UserService"); User expected = new User(1, new FullName("Alex", "Espinoza")); Action<User> callback = actual => { Assert.IsNotNull(actual); Assert.AreEqual(expected.Id, actual.Id); Assert.IsNotNull(actual.Name); Assert.AreEqual(expected.Name.FirstName, actual.Name.FirstName); Assert.AreEqual(expected.Name.LastName, actual.Name.LastName); }; Task<User> task = userSvc.ExecuteAsync(callback, "Create", new MethodParameter("id", expected.Id), new MethodParameter("name", expected.Name)); task.Wait(); }