Beispiel #1
0
        public async void GetOrCreateAsyncTest3()
        {
            var context = new MockContext <IApplication>();

            context.Arrange(m => m.List(The <ApplicationQuery> .IsAnyValue, null)).Returns(new Application[0]);
            context.Arrange(m => m.CreateAsync(The <CreateApplicationData> .Is(q => q.IncomingCallUrl == "https://localhost/bandwidth/callback/call"), null)).Returns(Task.FromResult("appId4"));
            var application = new MockApplication(context);
            var id          = await application.GetOrCreateAsync("app", "localhost");

            Assert.Equal("appId4", id);
        }
Beispiel #2
0
        public async void GetOrCreateAsyncTest()
        {
            var context = new MockContext <IApplication>();

            context.Arrange(m => m.List(The <ApplicationQuery> .IsAnyValue, null)).Returns(new [] {
                new Application
                {
                    Id   = "appId2",
                    Name = "app on localhost"
                }
            });
            var application = new MockApplication(context);
            var id          = await application.GetOrCreateAsync(new CreateApplicationData
            {
                Name = "app"
            }, "localhost");

            Assert.Equal("appId2", id);
        }