public async Task Text_with_Numeric_originator()
        {
            // ARRANGE
            Originator originator = Originator.AsPhoneNumber("8888");
            var        message    = new TextSmsMessage("Hello, World!", "0012345")
            {
                MaxMessageCount = 1,
                EncodingType    = TextEncodingType.Gsm0338
            };

            // ACT
            await _gateway.Send(originator, message);

            // ASSERT
            AssertBody(new Dictionary <string, string>
            {
                { "username", "MyName" },
                { "password", "MyPassword" },
                { "originatortype", "numeric" },
                { "originator", "8888" },
                { "destination", "0012345" },
                { "type", "text" },
                { "charset", "UTF-8" },
                { "text", "Hello, World!" }
            });
        }
Beispiel #2
0
            public void Fifteen_digits_is_valid()
            {
                Originator originator = Originator.AsPhoneNumber("123456789012345");

                originator.ShouldNotBeNull();
                originator.Type.ShouldBe(OriginatorType.PhoneNumber);
                originator.Value.ShouldBe("123456789012345");
            }
Beispiel #3
0
            public void One_digit_is_valid()
            {
                Originator originator = Originator.AsPhoneNumber("1");

                originator.ShouldNotBeNull();
                originator.Type.ShouldBe(OriginatorType.PhoneNumber);
                originator.Value.ShouldBe("1");
            }
Beispiel #4
0
 public void Non_digits_is_invalid()
 {
     Should.Throw <OriginatorException>(() => Originator.AsPhoneNumber("123A45"))
     .ErrorCode.ShouldBe(OriginatorErrorCode.NonNumeric);
 }
Beispiel #5
0
 public void Sixteen_digits_is_invalid()
 {
     Should.Throw <OriginatorException>(() => Originator.AsPhoneNumber("1234567890123456"))
     .ErrorCode.ShouldBe(OriginatorErrorCode.TooLong);
 }
Beispiel #6
0
 public void Leading_zero_is_invalid()
 {
     Should.Throw <OriginatorException>(() => Originator.AsPhoneNumber("0123"))
     .ErrorCode.ShouldBe(OriginatorErrorCode.LeadingZero);
 }
Beispiel #7
0
 public void Empty_is_invalid()
 {
     Should.Throw <OriginatorException>(() => Originator.AsPhoneNumber(string.Empty))
     .ErrorCode.ShouldBe(OriginatorErrorCode.Empty);
 }
Beispiel #8
0
 public void Null_is_invalid()
 {
     Should.Throw <ArgumentNullException>(() => Originator.AsPhoneNumber(null));
 }