jeudi 20 août 2015

NUnit Doesn't See A Specific Unit Test

enter image description here

Not much to the question - NUnit doesn't see "SetItemSequentialOrgId", but sees all the other tests. I have included a test that NUnit DOES see, and then the one it doesn't see. I can't seem to find the difference. I have tried restarting, reinstalling NUnit, reloading the project, etc. Even John Skeet's answer didn't help me.

Including code as is. Don't expect you to read it, but maybe you can see something obvious related to the test being visible.

[Test]
        public async Task UpdateItemCollectionWithForeignKeyValuesPeople()
        {
            var filterRecoveredByNull = Builders<BsonDocument>.Filter.Eq("RecoveredById", "null");
            var updateRecoveredByNull = Builders<BsonDocument>.Update.Set("RecoveredById", 1);

        await mongoItems.UpdateManyAsync(filterRecoveredByNull, updateRecoveredByNull);

        Dictionary<long, string> people = new Dictionary<long, string>();
        people = sqldb.People.OrderBy(p => p.Id).Take(250).ToDictionary(x => x.Id, x => x.Name);

        foreach (var key in people.Keys)
        {
            var insertingValue = people[key];

            var filterRecoveredBy = Builders<BsonDocument>.Filter.Eq("RecoveredById", key);
            var updateRecoveredBy = Builders<BsonDocument>.Update.Set("RecoveredBy", insertingValue);
            var filterCustodians = Builders<BsonDocument>.Filter.Eq("CustodianId", key);
            var updateCustodians = Builders<BsonDocument>.Update.Set("Custodian", insertingValue);

            await mongoItems.UpdateManyAsync(filterRecoveredBy, updateRecoveredBy);
            await mongoItems.UpdateManyAsync(filterCustodians, updateCustodians);
        }

        people = sqldb.People.OrderBy(p => p.Id).Skip(250).Take(250).ToDictionary(x => x.Id, x => x.Name);

        foreach (var key in people.Keys)
        {
            var insertingValue = people[key];

            var filterRecoveredBy = Builders<BsonDocument>.Filter.Eq("RecoveredById", key);
            var updateRecoveredBy = Builders<BsonDocument>.Update.Set("RecoveredBy", insertingValue);
            var filterCustodians = Builders<BsonDocument>.Filter.Eq("CustodianId", key);
            var updateCustodians = Builders<BsonDocument>.Update.Set("Custodian", insertingValue);

            await mongoItems.UpdateManyAsync(filterRecoveredBy, updateRecoveredBy);
            await mongoItems.UpdateManyAsync(filterCustodians, updateCustodians);
        }
    }

    [Test]
    public async Task SetItemSequentialOrgId()
    {
        AutomapperSetup.Setup();

        var seqOrgIdStr = PropUtils.GetPropertyName<ItemViewModel>(x => x.SequentialOrgId);

        var mongoItemHistory = db.GetCollection<BsonDocument>(MongoConstants.ItemHistoryCollection);            
        var emptyItemHistoryUpdate = Builders<BsonDocument>.Update.Set("Item." + seqOrgIdStr, (long)-1);
        await mongoItemHistory.UpdateManyAsync(new BsonDocument(), emptyItemHistoryUpdate);            

        var filterByDefaultOrg = Builders<BsonDocument>.Filter.Eq("CreatingOrgId", (long)0);
        var emptyItemUpdate = Builders<BsonDocument>.Update.Set(seqOrgIdStr, (long)-1);
        await mongoItems.UpdateManyAsync(filterByDefaultOrg, emptyItemUpdate);

        foreach (var org in sqldb.Organizations)
        {
            org.NextItemId = 1;
            var filterByOrg = Builders<BsonDocument>.Filter.Eq("CreatingOrgId", org.Id);
            var items = await mongoItems.Find(filterByOrg).ToListAsync();
            foreach (var item in items)
            {
                var itemFilter = Builders<BsonDocument>.Filter.Eq("_id", item.GetValue("_id").AsInt64);
                var itemUpdate = Builders<BsonDocument>.Update.Set(seqOrgIdStr, (long)org.NextItemId++);
                await mongoItems.UpdateOneAsync(itemFilter, itemUpdate);
            }
        }

        await sqldb.SaveChangesAsync();
    }
}

Aucun commentaire:

Enregistrer un commentaire