Example #1
0
 //[ExpectedException(typeof(SparkDeviceException), "Function not found")]
 public void GivenInvalidFunctionExpectErrorFunctionNotFound()
 {
     try{
         SparkFunctionResult result = client.ExecuteFunction("thisdoesnotexist");
     }
     catch (SparkDeviceException spex)
     {
         Assert.AreEqual("Function not found", spex.Message);
     }
 }
Example #2
0
        //[ExpectedException(typeof(SparkApiException), "Permission Denied")]
        public void GivenInvalidDeviceIdExpectErrorPermissionDenied()
        {
            var badClient = new SparkClient(client.AccessToken, "badid");

            try {
                SparkFunctionResult result = badClient.ExecuteFunction("doesn't matter");
            }
            catch (SparkApiException spex)
            {
                Assert.AreEqual("Permission Denied", spex.Message);
            }
        }
Example #3
0
        //[ExpectedException(typeof(SparkApiException), "invalid_grant")]
        public void GivenInvalidAccessTokenExpectErrorInvalidGrant()
        {
            var badClient = new SparkClient("badtoken", "");

            try
            {
                SparkFunctionResult result = badClient.ExecuteFunction("doesn't matter");
            }
            catch (SparkApiException spex)
            {
                Assert.AreEqual("invalid_grant", spex.Message);
            }
        }
Example #4
0
        public void GivenClientWhenExecuteReturnOneExpect1()
        {
            SparkFunctionResult result = client.ExecuteFunction("returnOne");

            Assert.AreEqual("1", result.Return_value);
        }