コード例 #1
0
        public async Task FindAllTenantEntities_Test() // TODO: move to own test class + mocks
        {
            // arrange
            var sut = new RepositorySpecificationDecorator <StubPerson>(
                new Specification <StubPerson>(t => t.TenantId == this.tenantId),
                new InMemoryRepository <StubPerson, StubDb>(o => o
                                                            .Mediator(Substitute.For <IMediator>())
                                                            .Context(new InMemoryContext <StubPerson>(this.entities))
                                                            .Mapper(new AutoMapperEntityMapper(StubEntityMapperConfiguration.Create())),
                                                            e => e.Identifier));

            // act
            var result = await sut.FindAllAsync().AnyContext();

            // assert
            Assert.False(result.IsNullOrEmpty());
            Assert.Equal(21, result.Count());
            Assert.NotNull(result.FirstOrDefault(e => e.Id == "Id99"));
        }