示例#1
0
        public void FindCustomers_TenantFilteringDisabled()
        {
            // assemble
            TenantContext.SetTenantToMaster();

            var firstTenantCustomer  = CustomerTestHelper.CreateAnonymousCustomer();
            var secondTenantCustomer = CustomerTestHelper.CreateAnonymousCustomer();


            // act
            List <CustomerViewModel> customers = DomainFacade.FindCustomers();

            // assert
            customers.Should().NotBeEmpty().And.HaveCount(2);
            customers.Should().Contain(x => x.Name.Equals(firstTenantCustomer.Name));
            customers.Should().Contain(x => x.Name.Equals(secondTenantCustomer.Name));
        }
示例#2
0
        public void FindCustomers_MultipleTenants()
        {
            // assemble
            var firstTenant  = TenantTestHelper.CreateAnonymousTenantId();
            var secondTenant = TenantTestHelper.CreateAnonymousTenantId();

            TenantContext.SetTenant(firstTenant);
            var firstTenantCustomer = CustomerTestHelper.CreateAnonymousCustomer();

            TenantContext.SetTenant(secondTenant);
            var secondTenantCustomer = CustomerTestHelper.CreateAnonymousCustomer();


            // act
            List <CustomerViewModel> customers = DomainFacade.FindCustomers();

            // assert
            customers.Should().NotBeEmpty().And.Contain(x => x.Name.Equals(secondTenantCustomer.Name));
        }