Example #1
0
        public void DummyClassMethod_Create_CheckUri()
        {
            SDK.CleanConfiguration();
            SDK.SetBaseUrl("https://httpbin.org");
            SDK.AccessToken = Environment.GetEnvironmentVariable("ACCESS_TOKEN");

            DummyClass resource = new DummyClass();

            resource.address = "Evergreen 123";
            resource.email   = "*****@*****.**";

            DummyClass result = new DummyClass();

            try
            {
                result = resource.Save();
            }
            catch
            {
                Assert.Fail();
                return;
            }

            Assert.AreEqual("POST", result.GetLastApiResponse().HttpMethod);

            Assert.AreEqual(string.Format("https://httpbin.org/post?access_token={0}", Environment.GetEnvironmentVariable("ACCESS_TOKEN")), result.GetLastApiResponse().Url);
        }
Example #2
0
        public void DummyClassMethod_WitAttributes_CreateNonStaticMethodShouldFindAttribute()
        {
            DummyClass resource = new DummyClass();
            DummyClass result   = new DummyClass();
            Dictionary <string, string> config = new Dictionary <string, string>();

            config.Add("clientSecret", Environment.GetEnvironmentVariable("CLIENT_SECRET"));
            config.Add("clientId", Environment.GetEnvironmentVariable("CLIENT_ID"));
            config.Add("accessToken", Environment.GetEnvironmentVariable("ACCESS_TOKEN"));
            SDK.SetConfiguration(config);

            try
            {
                result = resource.Save();
            }
            catch
            {
                // should never get here
                Assert.Fail();
                return;
            }

            Assert.Pass();
        }