public void ShouldGetApplicationProfile() { var vendor = new Vendor { VendorName = "test vendor" }; var application = new Application { ApplicationName = "test application", OperationalContextUri = OperationalContext.DefaultOperationalContextUri }; var profile = new Profile { Applications = new List <Application> { application }, ProfileName = "test profile" }; application.Profiles.Add(profile); vendor.Applications.Add(application); Save(vendor); var profileId = profile.ProfileId; profileId.ShouldBeGreaterThan(0); Scoped <IUsersContext>(usersContext => { var getApplicationsByVendorIdQuery = new GetApplicationsByVendorIdQuery(usersContext); var results = getApplicationsByVendorIdQuery.Execute(vendor.VendorId); results.Single().Profiles.Single().ProfileId.ShouldBe(profileId); }); }
public void ShouldGetApplicationEducationOrganization() { var vendor = new Vendor { VendorName = "test vendor" }; var application = new Application { ApplicationName = "test application", Vendor = vendor, OperationalContextUri = OperationalContext.DefaultOperationalContextUri }; var applicationOrganization = new ApplicationEducationOrganization { Application = application }; application.ApplicationEducationOrganizations.Add(applicationOrganization); vendor.Applications.Add(application); Save(vendor); var organizationId = applicationOrganization.ApplicationEducationOrganizationId; organizationId.ShouldBeGreaterThan(0); Scoped <IUsersContext>(usersContext => { var getApplicationsByVendorIdQuery = new GetApplicationsByVendorIdQuery(usersContext); var results = getApplicationsByVendorIdQuery.Execute(vendor.VendorId); results.Single().ApplicationEducationOrganizations.Single().ApplicationEducationOrganizationId.ShouldBe(organizationId); }); }
public void ShouldThrowWhenVendorIdIsInvalid() { Scoped <IUsersContext>(usersContext => { var getApplicationsByVendorIdQuery = new GetApplicationsByVendorIdQuery(usersContext); Should.Throw <NotFoundException <int> >(() => { getApplicationsByVendorIdQuery.Execute(int.MaxValue); }); }); }
public void ShouldGetBasicApplicationData() { var vendor = new Vendor { VendorName = "test vendor" }; var application = new Application { ApplicationName = "test application", ClaimSetName = "test claim set", Vendor = vendor, OperationalContextUri = OperationalContext.DefaultOperationalContextUri }; vendor.Applications.Add(application); Save(vendor); var getApplicationsByVendorIdQuery = new GetApplicationsByVendorIdQuery(TestContext); var results = getApplicationsByVendorIdQuery.Execute(vendor.VendorId); results.Single().ApplicationName.ShouldBe("test application"); results.Single().ClaimSetName.ShouldBe("test claim set"); }
internal Task <IResult> GetVendorApplications(GetApplicationsByVendorIdQuery getApplicationByVendorIdQuery, IMapper mapper, int id) { var vendorApplications = mapper.Map <List <ApplicationModel> >(getApplicationByVendorIdQuery.Execute(id)); return(Task.FromResult(AdminApiResponse <List <ApplicationModel> > .Ok(vendorApplications))); }