Ejemplo n.º 1
0
        public async void CreateLocalAsyncTest()
        {
            var context = new MockContext <IPhoneNumber>();
            var availableNumberContext = new MockContext <IAvailableNumber>();

            context.Arrange(m => m.UpdateAsync("phoneNumberId", The <UpdatePhoneNumberData> .Is(d => d.ApplicationId == "appId" && d.Name == "name"), null)).Returns(Task.FromResult(0));
            availableNumberContext.Arrange(m => m.SearchAndOrderLocalAsync(The <LocalNumberQueryForOrder> .Is(q => q.AreaCode == "910" && q.Quantity.Value == 1), null)).Returns(Task.FromResult(
                                                                                                                                                                                     new[]
            {
                new OrderedNumber
                {
                    Number   = "+1234567890",
                    Location = "http://lovalhost/phoneNumberId"
                }
            }
                                                                                                                                                                                     ));
            var phoneNumber = new MockPhoneNumber(context);
            var number      = await phoneNumber.CreateLocalAsync(new MockAvailableNumber(availableNumberContext), "appId", new LocalNumberQueryForOrder
            {
                AreaCode = "910"
            }, "name", null);

            Assert.Equal("+1234567890", number);
        }