public ApplicationNameAlreadyExistsException NewApplicationWithExistingNameInOrganisation() { var organisationResource = new Api().Resource<OrganisationResource>(); var organisationId = organisationResource.NewOrganisation().Id; try { const string alreadyExistingName = "nameThatWillAlreadyExist"; _applicationsServiceAgent.Post(new Application {Active = true, Name = alreadyExistingName, OrganisationId = organisationId}); _applicationsServiceAgent.Post(new Application {Active = true, Name = alreadyExistingName, OrganisationId = organisationId}); } catch (ApplicationNameAlreadyExistsException ex) { return ex; } throw new SpecFlowException(); }
public Application NewApplicationWithSpecifiedName(string name) { OrganisationResource resource = new Api().Resource<OrganisationResource>(); string organisationId = resource.NewOrganisation().Id; Application response = _applicationsServiceAgent.Post( new Application { Active = true, Name = name, OrganisationId = organisationId }); return response; }