Ejemplo n.º 1
0
 public void CheckDeleteAllContacts()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("1");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.DeleteAllContacts();
 }
Ejemplo n.º 2
0
 public void CheckEmptyGroup()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("1");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.EmptyGroup("group1");
 }
Ejemplo n.º 3
0
 public void CheckDeleteGroupError()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.DeleteGroup("somegroup");
 }
Ejemplo n.º 4
0
 public void CheckSendMessageToUserBadModelState()
 {
     var client = new FastSmsClient();
     client.SendMessage( new SendMessageToUserRequest {
         DestinationAddress = "bad destination"
     } );
 }
 public void TestMessageStatusError()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.CheckMessageStatus("16");
 }
Ejemplo n.º 6
0
 public void CheckGetReportsError()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.GetReports(ReportType.Messages, "20141025000000", "20151027000000");
 }
Ejemplo n.º 7
0
 public void CheckUpdateCreditsError()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.UpdateCredits("user2", 3);
 }
Ejemplo n.º 8
0
 public void CheckCreateUser()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("1");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.CreateUser(new CreateUserRequest());
 }
Ejemplo n.º 9
0
 public void CheckSendMessageToUserError()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");
     var client = new FastSmsClient("Token", httpClient.Object);
     client.SendMessage(new SendMessageToUserRequest());
 }
Ejemplo n.º 10
0
 public void TestMessageStatusUndeliverable()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("Undeliverable");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.CheckMessageStatus("15");
     Assert.AreEqual(result, "Undeliverable");
 }
Ejemplo n.º 11
0
 public void CheckCreditsFirstMoq()
 {
     var httpClient =
     Mock.Of<IHttpClient>(d => d.GetResponse("https://my.fastsms.co.uk/api?Token=Token&Action=CheckCredits", true) == "0m");
     var client = new FastSmsClient("Token", httpClient);
     var result = client.CheckCredits();
     Assert.AreEqual(result, 0);
 }
Ejemplo n.º 12
0
 public void CheckSendMessageToListBadModelState()
 {
     var client = new FastSmsClient();
     client.SendMessage( new SendMessageToListRequest {
         ListName = "Bad list name",
         Body = "body",
         SourceAddress = ""
     } );
 }
Ejemplo n.º 13
0
 public void CheckSendMessageToGroupBadModelState()
 {
     var client = new FastSmsClient();
     client.SendMessage( new MessageToGroupRequest {
         GroupName = "bad group name",
         SourceAddress = "bad source",
         Body = "some text"
     } );
 }
Ejemplo n.º 14
0
 public void CheckGetReportsUsage()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("\"Status\",\"Messages\"\n"
     +"\"Delivered\",\"31\"\n"
     +"\"Undeliverable\",\"17\"\n"
     +"\"Failed\",\"14\"");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.GetReports(ReportType.Usage, "20141025000000", "20151027000000");
     Assert.AreEqual(result.Count, 3);
 }
Ejemplo n.º 15
0
 public void CheckGetReportsOutbox()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("\"MessageID\",\"Username\",\"Destination\",\"Status\",\"Schedule Date\",\"Sent Date\",\"Delivery Date\"\n"
     + "\"55318001\",\"FS8561\",\"380965231000\",\"Delivered\",\"09/06/2015 16:48:24\",\"10/06/2015 07:45:01\",\"10/06/2015 07:45:12\"");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.GetReports(ReportType.Outbox, "20141025000000", "20151027000000");
     Assert.AreEqual(result.Count, 1);
     Assert.IsTrue(result[0] is OutboxReportResponse);
     Assert.AreEqual((result[0] as OutboxReportResponse).MessageId, "55318001");
 }
Ejemplo n.º 16
0
 public void CheckGetReportsInboundMessages()
 {
     var httpClient = new Mock<IHttpClient>();
     httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("\"MessageID\",\"From\",\"Number\",\"Message\",\"Received Date\",\"Status\"\n"
         + "\"55318001\",\"From\",\"380965231000\",\"Message\",\"09/06/2015 16:48:24\",\"Delivered\"");
     var client = new FastSmsClient("Token", httpClient.Object);
     var result = client.GetReports(ReportType.InboundMessages, "20141025000000", "20151027000000");
     Assert.AreEqual(result.Count, 1);
     Assert.IsTrue(result[0] is InboundMessagesReportResponse);
     Assert.AreEqual((result[0] as InboundMessagesReportResponse).MessageId, "55318001");
 }
Ejemplo n.º 17
0
        public void ContactsTestError()
        {
            var httpClient = new Mock<IHttpClient>();
            httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("-100");

            var client = new FastSmsClient("Token", httpClient.Object);
            var listParameters = new List<ImportContactsRequest>
            {
                new ImportContactsRequest
                {
                    Name = "NameZ1111",
                    Number = "0984784",
                    Group1 = "group1"
                },
            };
            var result = client.ImportContactsCsv(listParameters);
        }
Ejemplo n.º 18
0
        public void ContactsTestSuccess()
        {
            var httpClient = new Mock<IHttpClient>();
            httpClient.Setup(d => d.GetResponse(It.IsAny<string>(), true)).Returns("1 : Success");

            var client = new FastSmsClient("Token", httpClient.Object);
            var listParameters = new List<ImportContactsRequest>
            {
                new ImportContactsRequest
                {
                    Name = "NameZ1111",
                    Number = "0984784",
                    Group1 = "group1"
                },
            };
            var result = client.ImportContactsCsv(listParameters);
            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result[0].Status, "Success");
        }
Ejemplo n.º 19
0
 public void CheckGetReportsBadToken()
 {
     var client = new FastSmsClient("Token");
     client.GetReports(ReportType.Messages, "20151025000000", "20151027000000");
 }
Ejemplo n.º 20
0
 public void TestInitialize()
 {
     Client = new FastSmsClient();
 }
Ejemplo n.º 21
0
 public void CheckEmptyGroupBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.EmptyGroup( "group1" );
 }
Ejemplo n.º 22
0
 public void CheckDeleteGroupBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.DeleteGroup( "group1" );
 }
Ejemplo n.º 23
0
 public void CheckDeleteAllGroupsBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.DeleteAllGroups();
 }
Ejemplo n.º 24
0
 public void CheckDeleteAllContactsBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.DeleteAllContacts();
 }
Ejemplo n.º 25
0
 public void CheckUpdateCreditsBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.UpdateCredits( "NameZ1111", 23 );
 }
Ejemplo n.º 26
0
 public void CheckMessageStatusBadToken()
 {
     Client = new FastSmsClient( "Token" );
     Client.CheckMessageStatus( "73786923" );
 }
Ejemplo n.º 27
0
        public void getReports()
        {
            var reportName = "InboundMessage";

            var fromDate = "20131031111841";

            var toDate = "20161101111843";

            var client = new FastSmsClient("6Art-RoFX-VlBH-rggL");

            var reportType = ReportType.Messages;
            switch (reportName)
            {
                case "InboundMessages":
                    reportType = ReportType.InboundMessages;
                    break;
                case "Messages":
                    reportType = ReportType.Messages;
                    break;
                case "Outbox":
                    reportType = ReportType.Outbox;
                    break;
                case "Usage":
                    reportType = ReportType.Usage;
                    break;
            }
            try
            {
                var reports = client.GetReports(reportType, fromDate, toDate);
                //foreach (var report in reports)
                //{
                //    smsInboundMessageInsert(report);
                //}
            }
            catch (FastSmsException exception)
            {

            }
        }
Ejemplo n.º 28
0
 public void CheckSendMessageToUserBadToken()
 {
     var client = new FastSmsClient( "bad token" );
     client.SendMessage( new SendMessageToUserRequest() );
 }
Ejemplo n.º 29
0
 public void CheckImportContactsCsvBadToken()
 {
     var newClient = new FastSmsClient( "Token" );
     newClient.ImportContactsCsv( ContactModelList );
 }
Ejemplo n.º 30
0
        public void TestInitialize()
        {
            Client = new FastSmsClient();
            Client.DeleteAllContacts();
            ContactModelList = new List<ImportContactsRequest> {
                new ImportContactsRequest {
                    Name = "NameZ1111",
                    Number = "0984784",
                    Group1 = "group1"
                },
                new ImportContactsRequest {
                    Name = "NameZ2111",
                    Number = "0984724344555842",
                    Group1 = "group1_2",
                    Group2 = "group2_2",
                    Group3 = "group3_3"
                },
                new ImportContactsRequest {
                    Name = "",
                    Number = "0984734442842",
                    Group1 = "group1",
                    Group2 = "group2"
                },
                new ImportContactsRequest {
                    Name = "NZame3111",
                    Number = "",
                    Group1 = "group1",
                    Group2 = "group2"
                },
                new ImportContactsRequest {
                    Name = "NZame4111",
                    Number = "somenumber",
                    Group1 = "group1",
                    Group2 = "group2"
                },
                new ImportContactsRequest {
                    Name = "ZName5111",
                    Number = "35682258"
                },
                new ImportContactsRequest {
                    Name = "NameZ1111",
                    Number = "3568234534258",
                    Group1 = "group1_6"
                },
                new ImportContactsRequest {
                    Name = "Name6111Z",
                    Number = "0984784",
                    Group1 = "group1_7"
                }
            };

            ImportContactsCsvResults = Client.ImportContactsCsv( ContactModelList );
        }