public async Task Getting_default_group_store(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var app    = await client.GetResourceAsync <IApplication>(this.fixture.PrimaryApplicationHref);

            var defaultGroupStore = await app.GetDefaultGroupStoreAsync();

            defaultGroupStore.ShouldNotBeNull();
        }
Ejemplo n.º 2
0
        public async Task Getting_tenant_organizations(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var orgs = await tenant.GetOrganizations().ToListAsync();

            orgs.Count.ShouldBeGreaterThan(0);
        }
        public async Task Expanding_organization(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var app    = await client.GetResourceAsync <IOrganization>(this.fixture.PrimaryOrganizationHref);

            var mapping = await app.GetAccountStoreMappings().FirstAsync();

            await client.GetResourceAsync <IOrganizationAccountStoreMapping>(mapping.Href, o => o.Expand(x => x.GetOrganization()));
        }
        public void Getting_tenant_accounts(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = client.GetCurrentTenant();

            var accounts = tenant.GetAccounts().Synchronously().ToList();

            accounts.Any().ShouldBeTrue();
        }
Ejemplo n.º 5
0
        public async Task Getting_tenant_accounts(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var accounts = await tenant.GetAccounts().ToListAsync();

            accounts.Any().ShouldBeTrue();
        }
Ejemplo n.º 6
0
        public async void Should_Return_All_Fruits()
        {
            using (var client = new TestClientProvider <TestStartup>().Client)
            {
                var response = await client.GetAsync("/api/fruits");

                response.StatusCode.Should().Be(HttpStatusCode.OK);
            }
        }
Ejemplo n.º 7
0
        public async void test1()
        {
            var client   = new TestClientProvider().client;
            var response = await client.GetAsync("/Movies");

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
Ejemplo n.º 8
0
        public async Task GetProductById_Returns_NotFound()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.GetAsync($"/api/product/getone");

                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
Ejemplo n.º 9
0
        public void Getting_default_account_store(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var app    = client.GetResource <IApplication>(this.fixture.PrimaryApplicationHref);

            var defaultAccountStore = app.GetDefaultAccountStore();

            defaultAccountStore.ShouldNotBeNull();
        }
        public async Task Expanding_application_from_generic_mapping(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var app    = await client.GetResourceAsync <IApplication>(this.fixture.PrimaryApplicationHref);

            var mapping = await app.GetAccountStoreMappings().FirstAsync();

            await client.GetResourceAsync <IAccountStoreMapping>(mapping.Href, o => o.Expand(x => x.GetApplication()));
        }
Ejemplo n.º 11
0
        public void Counting_accounts(TestClientProvider clientBuilder)
        {
            var client      = clientBuilder.GetClient();
            var application = client.GetResource <IApplication>(this.fixture.PrimaryApplicationHref);

            var count = application.GetAccounts().Synchronously().Count();

            count.ShouldBeGreaterThanOrEqualTo(8);
        }
Ejemplo n.º 12
0
        public async Task GetNonExistingOrderById_Returns_NotFound()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.GetAsync("/api/orders/" + Guid.Empty);

                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
Ejemplo n.º 13
0
        public async Task Counting_accounts(TestClientProvider clientBuilder)
        {
            var client      = clientBuilder.GetClient();
            var application = await client.GetResourceAsync <IApplication>(this.fixture.PrimaryApplicationHref);

            var count = await application.GetAccounts().CountAsync();

            count.ShouldBeGreaterThanOrEqualTo(8);
        }
Ejemplo n.º 14
0
        public async Task GetEmptyGuid_Returns_NotFound()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.GetAsync($"/api/orders/{Guid.Empty}");

                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }
Ejemplo n.º 15
0
        public async Task Delete_Order_EmptyGuid_returns_NotFound()
        {
            using (var client = new TestClientProvider().Client)
            {
                var deleteresponse = await client.DeleteAsync($"/api/orders/delete/{Guid.Empty}");

                Assert.Equal(HttpStatusCode.NotFound, deleteresponse.StatusCode);
            }
        }
Ejemplo n.º 16
0
        public void Getting_organization(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = client.GetCurrentTenant();

            var org = tenant.GetOrganization(this.fixture.PrimaryOrganizationHref);

            org.NameKey.ShouldBe(this.fixture.PrimaryOrganizationNameKey);
            org.Href.ShouldBe(this.fixture.PrimaryOrganizationHref);
        }
Ejemplo n.º 17
0
        public void Getting_directory_tenant(TestClientProvider clientBuilder)
        {
            var client    = clientBuilder.GetClient();
            var directory = client.GetResource <IDirectory>(this.fixture.PrimaryDirectoryHref);

            // Verify data from IntegrationTestData
            var tenantHref = directory.GetTenant().Href;

            tenantHref.ShouldBe(this.fixture.TenantHref);
        }
        public async Task Getting_directory_tenant(TestClientProvider clientBuilder)
        {
            var client    = clientBuilder.GetClient();
            var directory = await client.GetResourceAsync <IDirectory>(this.fixture.PrimaryDirectoryHref);

            // Verify data from IntegrationTestData
            var tenantHref = (await directory.GetTenantAsync()).Href;

            tenantHref.ShouldBe(this.fixture.TenantHref);
        }
Ejemplo n.º 19
0
        public void Getting_account_groups(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var app    = client.GetResource <IApplication>(this.fixture.PrimaryApplicationHref);
            var luke   = app.GetAccounts().Synchronously().Where(x => x.Email.StartsWith("lskywalker")).Single();

            var groups = luke.GetGroups().Synchronously().ToList();

            groups.Count.ShouldBeGreaterThan(0);
        }
Ejemplo n.º 20
0
        public void Getting_group_tenant(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var group  = client.GetResource <IGroup>(this.fixture.PrimaryGroupHref);

            // Verify data from IntegrationTestData
            var tenantHref = group.GetTenant().Href;

            tenantHref.ShouldBe(this.fixture.TenantHref);
        }
Ejemplo n.º 21
0
        public async Task Getting_organization(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var org = await tenant.GetOrganizationAsync(this.fixture.PrimaryOrganizationHref);

            org.NameKey.ShouldBe(this.fixture.PrimaryOrganizationNameKey);
            org.Href.ShouldBe(this.fixture.PrimaryOrganizationHref);
        }
Ejemplo n.º 22
0
        public async Task Getting_account_applications(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();

            var luke = await client.GetAccountAsync(this.fixture.PrimaryAccountHref);

            var apps = await luke.GetApplications().ToListAsync();

            apps.Where(x => x.Href == this.fixture.PrimaryApplicationHref).Any().ShouldBeTrue();
        }
Ejemplo n.º 23
0
        public async Task Getting_account(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var account = await tenant.GetAccountAsync(this.fixture.PrimaryAccountHref);

            account.Href.ShouldBe(this.fixture.PrimaryAccountHref);
            account.FullName.ShouldBe("Luke Skywalker");
        }
        public async Task Expanding_oAuthPolicy(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var app = await tenant
                      .GetApplications()
                      .Expand(x => x.GetOauthPolicy())
                      .FirstOrDefaultAsync();
        }
Ejemplo n.º 25
0
        public async Task Getting_application(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var tenant = await client.GetCurrentTenantAsync();

            var app = await tenant.GetApplicationAsync(this.fixture.PrimaryApplicationHref);

            app.Href.ShouldBe(this.fixture.PrimaryApplicationHref);
            app.Description.ShouldBe("The Battle of Endor");
        }
Ejemplo n.º 26
0
        public void Getting_application_tenant(TestClientProvider clientBuilder)
        {
            var client      = clientBuilder.GetClient();
            var application = client.GetResource <IApplication>(this.fixture.PrimaryApplicationHref);

            // Verify data from IntegrationTestData
            var tenantHref = application.GetTenant().Href;

            tenantHref.ShouldBe(this.fixture.TenantHref);
        }
        public async Task Expanding_membership_group(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var group  = await client.GetResourceAsync <IGroup>(this.fixture.PrimaryGroupHref);

            var membership = await group
                             .GetAccountMemberships()
                             .Expand(x => x.GetGroup())
                             .FirstOrDefaultAsync();
        }
Ejemplo n.º 28
0
        public async Task Test_PostAd()
        {
            using (var httpClient = new TestClientProvider().HttpClient)
            {
                HttpResponseMessage response = await httpClient.GetAsync("/Ad/PostAd");

                response.EnsureSuccessStatusCode();
                response.StatusCode.Should().Be(HttpStatusCode.OK); // or old school: Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
Ejemplo n.º 29
0
        public async Task Getting_group_tenant(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();
            var group  = await client.GetResourceAsync <IApplication>(this.fixture.PrimaryGroupHref);

            // Verify data from IntegrationTestData
            var tenantHref = (await group.GetTenantAsync()).Href;

            tenantHref.ShouldBe(this.fixture.TenantHref);
        }
        public async Task Expanding_group(TestClientProvider clientBuilder)
        {
            var client = clientBuilder.GetClient();

            var account = await client.GetResourceAsync <IAccount>(this.fixture.PrimaryAccountHref);

            var membership = await account.GetGroupMemberships().FirstAsync();

            await client.GetResourceAsync <IGroupMembership>(membership.Href, o => o.Expand(x => x.GetGroup()));
        }