Beispiel #1
0
        public async Task GetMultipleSchemasByName()
        {
            // arrange
            IMongoCollection <Schema> schemas =
                _mongoResource.CreateCollection <Schema>();
            IMongoCollection <SchemaVersion> versions =
                _mongoResource.CreateCollection <SchemaVersion>();
            IMongoCollection <SchemaPublishReport> publishReports =
                _mongoResource.CreateCollection <SchemaPublishReport>();
            IMongoCollection <PublishedSchema> publishedSchemas =
                _mongoResource.CreateCollection <PublishedSchema>();

            var a = new Schema("foo1", "bar");
            var b = new Schema("foo2", "bar");
            await schemas.InsertOneAsync(a, options : null, default);

            await schemas.InsertOneAsync(b, options : null, default);

            var repository = new SchemaRepository(
                schemas, versions, publishReports, publishedSchemas);

            // act
            IReadOnlyDictionary <string, Schema> retrieved =
                await repository.GetSchemasAsync(new[] { a.Name, b.Name });

            // assert
            Assert.True(retrieved.ContainsKey(a.Name));
            Assert.True(retrieved.ContainsKey(b.Name));
        }