Exemple #1
0
 public BinarySmsMessageTests()
 {
     _message = new BinarySmsMessage
     {
         Destinations = { "00123" }
     };
 }
        public async Task Binary_with_only_UserDataHeader()
        {
            // ARRANGE
            var message = new BinarySmsMessage("0012345")
            {
                UserDataHeader = new byte[] { 10, 20, 30, 40, 50, 60, 70, 80 }
            };

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

            // ASSERT
            AssertBody(new Dictionary <string, string>
            {
                { "username", "MyName" },
                { "password", "MyPassword" },
                { "destination", "0012345" },
                { "type", "binary" },
                { "udh", "0A141E28323C4650" }
            });
        }
        public async Task Binary_with_only_Data()
        {
            // ARRANGE
            var message = new BinarySmsMessage("0012345")
            {
                Data = new byte[] { 12, 34, 56, 78, 90 }
            };

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

            // ASSERT
            AssertBody(new Dictionary <string, string>
            {
                { "username", "MyName" },
                { "password", "MyPassword" },
                { "destination", "0012345" },
                { "type", "binary" },
                { "data", "0C22384E5A" }
            });
        }
        public async Task Binary_with_both_UserDataHeader_and_Data()
        {
            // ARRANGE
            var message = new BinarySmsMessage(
                new byte[] { 10, 20, 30, 40, 50, 60, 70, 80 },
                new byte[] { 12, 34, 56, 78, 90 },
                "0012345");

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

            // ASSERT
            AssertBody(new Dictionary <string, string>
            {
                { "username", "MyName" },
                { "password", "MyPassword" },
                { "destination", "0012345" },
                { "type", "binary" },
                { "udh", "0A141E28323C4650" },
                { "data", "0C22384E5A" }
            });
        }