예제 #1
0
        public void ShouldGetApplicationAsynchronously()
        {
            manualResetEvent = new ManualResetEvent(false);

            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplication    = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplication.Sid);

            Application result = null;

            client.GetApplication(originalApplication.Sid, app => {
                result = app;
                manualResetEvent.Set();
            });

            manualResetEvent.WaitOne();

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.AreEqual(originalApplication.Sid, result.Sid);

            client.DeleteApplication(result.Sid); //cleanup
        }
예제 #2
0
        public void ShouldDeleteApplication()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplication    = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplication.Sid);

            var status = client.DeleteApplication(originalApplication.Sid);

            Assert.AreEqual(DeleteStatus.Success, status);
        }
예제 #3
0
        public void ShouldAddNewApplication()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();

            var result = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteApplication(result.Sid); //cleanup
        }
예제 #4
0
        public void ShouldAddNewApplication()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);
            
            ApplicationOptions options = new ApplicationOptions();

            var result = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteApplication(result.Sid); //cleanup
        }
예제 #5
0
        public void ShouldListApplicationsUsingFilters()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options   = new ApplicationOptions();
            var originalApplicationOne   = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);
            var originalApplicationTwo   = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);
            var originalApplicationThree = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplicationOne.Sid);
            Assert.IsNotNull(originalApplicationTwo.Sid);
            Assert.IsNotNull(originalApplicationThree.Sid);

            var result = client.ListApplications(originalApplicationTwo.FriendlyName, null, null);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Applications);
            Assert.IsNotNull(result.Applications.FirstOrDefault(a => a.FriendlyName == originalApplicationTwo.FriendlyName));

            client.DeleteApplication(originalApplicationOne.Sid);   //cleanup
            client.DeleteApplication(originalApplicationTwo.Sid);   //cleanup
            client.DeleteApplication(originalApplicationThree.Sid); //cleanup
        }
예제 #6
0
        public void ShouldDeleteApplicationAsynchronously()
        {
            manualResetEvent = new ManualResetEvent(false);

            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplication    = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplication.Sid);

            DeleteStatus status = DeleteStatus.Failed;

            client.DeleteApplication(originalApplication.Sid, app => {
                status = app;
                manualResetEvent.Set();
            });

            manualResetEvent.WaitOne();

            Assert.AreEqual(DeleteStatus.Success, status);
        }
예제 #7
0
        public void ShouldAddNewApplicationAsynchronously()
        {
            manualResetEvent = new ManualResetEvent(false);

            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();

            Application result = null;
            client.AddApplication(Utilities.MakeRandomFriendlyName(), options, app =>
            {
                result = app;
                manualResetEvent.Set();
            });

            manualResetEvent.WaitOne();

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Sid);

            client.DeleteApplication(result.Sid); //cleanup
        }
예제 #8
0
        public void ShouldDeleteApplicationAsynchronously()
        {
            manualResetEvent = new ManualResetEvent(false);

            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplication = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplication.Sid);

            DeleteStatus status = DeleteStatus.Failed;
            client.DeleteApplication(originalApplication.Sid, app => {
                status = app;
                manualResetEvent.Set();
            });

            manualResetEvent.WaitOne();

            Assert.AreEqual(DeleteStatus.Success, status);
        }
예제 #9
0
        public void ShouldDeleteApplication()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplication = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplication.Sid);

            var status = client.DeleteApplication(originalApplication.Sid);
            Assert.AreEqual(DeleteStatus.Success, status);
        }
예제 #10
0
        public void ShouldListApplicationsUsingFilters()
        {
            var client = new TwilioRestClient(Credentials.AccountSid, Credentials.AuthToken);

            ApplicationOptions options = new ApplicationOptions();
            var originalApplicationOne = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);
            var originalApplicationTwo = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);
            var originalApplicationThree = client.AddApplication(Utilities.MakeRandomFriendlyName(), options);

            Assert.IsNotNull(originalApplicationOne.Sid);
            Assert.IsNotNull(originalApplicationTwo.Sid);
            Assert.IsNotNull(originalApplicationThree.Sid);

            var result = client.ListApplications(originalApplicationTwo.FriendlyName, null, null);

            Assert.IsNotNull(result);
            Assert.IsNull(result.RestException);
            Assert.IsNotNull(result.Applications);
            Assert.IsNotNull(result.Applications.FirstOrDefault(a=>a.FriendlyName==originalApplicationTwo.FriendlyName));

            client.DeleteApplication(originalApplicationOne.Sid); //cleanup
            client.DeleteApplication(originalApplicationTwo.Sid); //cleanup
            client.DeleteApplication(originalApplicationThree.Sid); //cleanup
        }