public static async Task GetServiceRecipientsByParentOdsCode_NoOrganisations_ReturnsEmptyList() { var context = ServiceRecipientTestContext.Setup(); context.Http.RespondWith(status: 200, body: CreatePageJson()); var response = await context.Repository.GetServiceRecipientsByParentOdsCode(OdsCode); response.Should().BeEmpty(); }
public static async Task GetServiceRecipientsByParentOdsCode_SinglePage_ReturnsOrganisation() { var context = ServiceRecipientTestContext.Setup(); context.Settings.GetChildOrganisationSearchLimit = 2; var childOrg = new ServiceRecipient { Name = "Organisation 1", PrimaryRoleId = "RO177", OrgId = "ABC" }; var json = CreatePageJson(childOrg); context.Http.RespondWith(status: 200, body: json); var response = await context.Repository.GetServiceRecipientsByParentOdsCode(OdsCode); response.Should().BeEquivalentTo(new[] { childOrg }); }
public async Task GetServiceRecipientsByParentOdsCode_SinglePageDifferentRoleIds_ReturnsOnlyMatching() { var context = ServiceRecipientTestContext.Setup(); context.Settings.GetChildOrganisationSearchLimit = 3; var childOne = new ServiceRecipient { Name = "Organisation 1", PrimaryRoleId = "RO177", OrgId = "ABC" }; var childTwo = new ServiceRecipient { Name = "Organisation 2", PrimaryRoleId = "RO178", OrgId = "ABD" }; var jsonPageOne = CreatePageJson(childOne, childTwo); context.Http.RespondWith(status: 200, body: jsonPageOne); var response = await context.Repository.GetServiceRecipientsByParentOdsCode(OdsCode); response.Should().BeEquivalentTo(childOne); }
public static async Task GetServiceRecipientsByParentOdsCode_MultiplePage_ReturnsAllOrganisations() { var context = ServiceRecipientTestContext.Setup(); context.Settings.GetChildOrganisationSearchLimit = 1; var childOne = new ServiceRecipient { Name = "Organisation 1", PrimaryRoleId = "RO177", OrgId = "ABC" }; var childTwo = new ServiceRecipient { Name = "Organisation 2", PrimaryRoleId = "RO177", OrgId = "ABD" }; var jsonPageOne = CreatePageJson(childOne); var jsonPageTwo = CreatePageJson(childTwo); var jsonPageThree = CreatePageJson(); context.Http.RespondWith(status: 200, body: jsonPageOne); context.Http.RespondWith(status: 200, body: jsonPageTwo); context.Http.RespondWith(status: 200, body: jsonPageThree); var response = await context.Repository.GetServiceRecipientsByParentOdsCode(OdsCode); response.Should().BeEquivalentTo(new[] { childOne, childTwo }); }