예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void Execute_NoParamsTest()
        {
            ApplicationClient userSvc = new ApplicationClient(UserId, ApiKey, "UserService");

            string result = userSvc.Execute<string>("GetMostCommonFirstName");

            Assert.AreEqual("John", result);
        }
예제 #4
0
        public void Execute_withParamsTest()
        {
            ApplicationClient userSvc = new ApplicationClient(UserId, ApiKey, "UserService");

            string result = userSvc.Execute<string>("GetFirstNameById", new MethodParameter("id", 1));

            Assert.AreEqual("Robert", result);
        }