public void SuccessfullyUpdateEntity()
        {
            var connection = TestConfiguration.GetConnection();
            var tenantId   = TestConfiguration.GetTenantId();
            var context    = new MongoDbTenantContext(connection, tenantId);
            var dbSet      = new MongoDbTenantSet <TestModel>(context);

            var entity = new TestModel
            {
                Description = "SuccessfullyUpdateEntity"
            };

            dbSet.Add(entity);
            context.SaveChanges();

            dbSet = new MongoDbTenantSet <TestModel>(context);

            entity.Description = "SuccessfullyUpdateEntity-Updated";
            dbSet.Update(entity);

            Assert.IsFalse(dbSet.Any(m => m.Description == "SuccessfullyUpdateEntity-Updated"));
            context.SaveChanges();
            Assert.IsTrue(dbSet.Any(m => m.Description == "SuccessfullyUpdateEntity-Updated"));
            Assert.IsTrue(dbSet.First(m => m.Description == "SuccessfullyUpdateEntity-Updated").TenantId == tenantId);
        }
        public void SuccessfullyBlocksNulls()
        {
            var connection = TestConfiguration.GetConnection();
            var tenantId   = TestConfiguration.GetTenantId();
            var context    = new MongoDbTenantContext(connection, tenantId);
            var dbSet      = new MongoDbTenantSet <TestModel>(context);

            Assert.ThrowsException <ArgumentNullException>(() => dbSet.Add(null));
            Assert.ThrowsException <ArgumentNullException>(() => dbSet.AddRange(null));
            Assert.ThrowsException <ArgumentNullException>(() => dbSet.Update(null));
            Assert.ThrowsException <ArgumentNullException>(() => dbSet.UpdateRange(null));
        }
        public void SuccessfullyBlocksUpdateEntity()
        {
            var connection = TestConfiguration.GetConnection();
            var tenantId   = TestConfiguration.GetTenantId();
            var context    = new MongoDbTenantContext(connection, tenantId);
            var dbSet      = new MongoDbTenantSet <TestModel>(context);

            var entity = new TestModel
            {
                Description = "SuccessfullyBlocksUpdateEntity"
            };

            dbSet.Add(entity);
            context.SaveChanges();

            dbSet              = new MongoDbTenantSet <TestModel>(context);
            entity.TenantId    = "qweasd";
            entity.Description = "SuccessfullyBlocksUpdateEntity-Updated";
            Assert.ThrowsException <MultiTenantException>(() => dbSet.Update(entity));
        }