示例#1
0
        public void Throws_When_No_Collection_Name_Set()
        {
            var repo = new MongoDbTestRepository(_database, _tenantIdProviderMock.Object, string.Empty);

            Assert.ThrowsAsync <InvalidOperationException>(async() =>
                                                           await repo.GetByIdAsync(Guid.Parse("c3c7e5e9-6a11-407f-aeef-b0b286933eac")));
        }
示例#2
0
        public void Setup()
        {
            _collection = _database.GetCollection <TestDoc>(_collectionName);
            _collection.InsertMany(new List <TestDoc>
            {
                new TestDoc
                {
                    Id       = Guid.Parse("c3c7e5e9-6a11-407f-aeef-b0b286933eac"),
                    TenantId = Guid.Parse("49e49c89-7653-48d7-a263-899be2245eec"), Name = "Alpha"
                },
                new TestDoc
                {
                    Id       = Guid.Parse("c9abb508-0fed-4d1a-82ec-da1149b9965d"),
                    TenantId = Guid.Parse("49e49c89-7653-48d7-a263-899be2245eec"), Name = "Beta"
                },
                new TestDoc
                {
                    Id       = Guid.Parse("45f05cd4-5509-4bf8-b57c-efe96940e27f"),
                    TenantId = Guid.Parse("2a2d1781-6b96-4a55-9cb5-5f7c80aac27d"), Name = "Theta"
                }
            });

            _repository = new MongoDbTestRepository(_database, _tenantIdProviderMock.Object, _collectionName);
        }