Пример #1
0
        public void search_for_the_combination_of_soft_deleted_and_multi_tenancy()
        {
            var e1 = new SoftDeletedTenanted {
                Name = "Jeremy", TenantId = theContext.CurrentTenant, Id = Guid.NewGuid()
            };
            var e2 = new SoftDeletedTenanted {
                Name = "Jeremy", TenantId = Guid.NewGuid(), Id = Guid.NewGuid()
            };
            var e3 = new SoftDeletedTenanted {
                Name = "Josh", TenantId = theContext.CurrentTenant
            };
            var e4 = new SoftDeletedTenanted {
                Name = "Lindsey", TenantId = theContext.CurrentTenant
            };
            var e5 = new SoftDeletedTenanted {
                Name = "Max", TenantId = theContext.CurrentTenant
            };

            thePersistor.Persist(e1);
            thePersistor.Persist(e2);
            thePersistor.Persist(e3);
            thePersistor.Persist(e4);
            thePersistor.Persist(e5);

            theRepository.Remove(e1);

            theRepository.Find <SoftDeletedTenanted>(e1.Id).ShouldBeTheSameAs(e1);
            theRepository.Find <SoftDeletedTenanted>(e2.Id).ShouldBeNull(); // not the same tenant

            theRepository.FindWhere <SoftDeletedTenanted>(x => x.Name == "Jeremy").ShouldBeTheSameAs(e1);

            theRepository.All <SoftDeletedTenanted>().ShouldHaveTheSameElementsAs(e3, e4, e5);
        }
        public void search_for_the_combination_of_soft_deleted_and_multi_tenancy()
        {
            var e1 = new SoftDeletedTenanted {Name = "Jeremy", TenantId = theContext.CurrentTenant, Id = Guid.NewGuid()};
            var e2 = new SoftDeletedTenanted {Name = "Jeremy", TenantId = Guid.NewGuid(), Id = Guid.NewGuid()};
            var e3 = new SoftDeletedTenanted {Name = "Josh", TenantId = theContext.CurrentTenant};
            var e4 = new SoftDeletedTenanted {Name = "Lindsey", TenantId = theContext.CurrentTenant};
            var e5 = new SoftDeletedTenanted {Name = "Max", TenantId = theContext.CurrentTenant};

            thePersistor.Persist(e1);
            thePersistor.Persist(e2);
            thePersistor.Persist(e3);
            thePersistor.Persist(e4);
            thePersistor.Persist(e5);

            theRepository.Remove(e1);

            theRepository.Find<SoftDeletedTenanted>(e1.Id).ShouldBeTheSameAs(e1);
            theRepository.Find<SoftDeletedTenanted>(e2.Id).ShouldBeNull(); // not the same tenant

            theRepository.FindWhere<SoftDeletedTenanted>(x => x.Name == "Jeremy").ShouldBeTheSameAs(e1);

            theRepository.All<SoftDeletedTenanted>().ShouldHaveTheSameElementsAs(e3, e4, e5);
        }