コード例 #1
0
        public void Filter_None_Returns_All()
        {
            var orgFilt  = new OrganisationsFilter();
            var govOrg   = Creator.GetOrganisation(id: Guid.NewGuid().ToString(), primaryRoleId: PrimaryRole.GovernmentDepartment);
            var supp1Org = Creator.GetOrganisation(id: Guid.NewGuid().ToString(), primaryRoleId: PrimaryRole.ApplicationServiceProvider);
            var supp2Org = Creator.GetOrganisation(id: Guid.NewGuid().ToString(), primaryRoleId: PrimaryRole.ApplicationServiceProvider);
            var orgs     = new[] { govOrg, supp1Org, supp2Org };

            var filterOrg = orgFilt.Filter(orgs.ToList());

            filterOrg.Should().BeEquivalentTo(orgs);
        }
コード例 #2
0
        public void Filter_Supplier_Returns_NotOther()
        {
            var suppOrgId = Guid.NewGuid().ToString();
            var ctx       = Creator.GetContext(orgId: suppOrgId, role: Roles.Supplier);

            _context.Setup(c => c.HttpContext).Returns(ctx);
            var orgFilt  = new OrganisationsFilter(_context.Object);
            var govOrg   = Creator.GetOrganisation(id: Guid.NewGuid().ToString(), primaryRoleId: PrimaryRole.GovernmentDepartment);
            var supp1Org = Creator.GetOrganisation(id: suppOrgId, primaryRoleId: PrimaryRole.ApplicationServiceProvider);
            var supp2Org = Creator.GetOrganisation(id: Guid.NewGuid().ToString(), primaryRoleId: PrimaryRole.ApplicationServiceProvider);
            var orgs     = new[] { govOrg, supp1Org, supp2Org };

            var filterOrg = orgFilt.Filter(orgs.ToList());

            filterOrg.Should().BeEquivalentTo(new[] { govOrg, supp1Org });
        }