Exemplo n.º 1
0
        public async Task RetrievePlans(AvailableSmokeTestApplications smokeTestApplication)
        {
            using (var session = await StartSession(TestIsolationLevel.CompletelyIsolated))
            {
                IApprendaDeveloperPortalApiClient client = await session.GetClient();

                var alias = smokeTestApplication.ToString();
                using (var createApp = await CreateAppIfDoesNotExist(session, smokeTestApplication.ToString(), alias))
                {
                    await PromoteAppToSandbox(session, alias);

                    var app = await client.GetApplication(createApp.AppAlias);

                    Assert.NotNull(app);
                    var plans = await client.GetPlans(app.Alias, app.CurrentVersion.Alias);

                    foreach (var foundPlan in plans.Where(p => p != null))
                    {
                        var byId = await client.GetPlan(app.Alias, app.CurrentVersion.Alias, foundPlan.Id);

                        Assert.NotNull(byId);
                        Assert.Equal(foundPlan.Name, byId.Name);
                        Assert.NotNull(foundPlan.Href);
                        Assert.Equal(foundPlan.EntitlementDefintionType, byId.EntitlementDefintionType);
                        Assert.Equal(foundPlan.EntitlementName, byId.EntitlementName);
                        Assert.Equal(foundPlan.Href, byId.Href);
                        Assert.Contains(foundPlan.Id.ToString(), byId.Href);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async Task BothAccountAndUserPlansRetreive(AvailableSmokeTestApplications smokeTestApplication)
        {
            using (var session = await StartSession())
            {
                IApprendaDeveloperPortalApiClient client = await session.GetClient();

                var alias = smokeTestApplication.ToString().Substring(0, 10) + "plans";
                using (var createApp = await CreateAppIfDoesNotExist(session, smokeTestApplication.ToString(), alias))
                {
                    await PromoteAppToSandbox(session, alias);

                    var app = await client.GetApplication(createApp.AppAlias);

                    Assert.NotNull(app);
                    var plans = (await client.GetPlans(app.Alias, app.CurrentVersion.Alias)).ToList();

                    Assert.True(plans.Any(p => p.EntitlementDefintionType == EntitlementDefintionType.AccountWide));
                }
            }
        }