Beispiel #1
0
        public async Task GetSchemaByName()
        {
            // 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 initial = new Schema("foo", "bar");
            await schemas.InsertOneAsync(initial, options : null, default);

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

            // act
            Schema retrieved = await repository.GetSchemaAsync(initial.Name);

            // assert
            Assert.Equal(initial.Id, retrieved.Id);
            Assert.Equal(initial.Description, retrieved.Description);
        }