public void TestInstanceBsonCollectionName() { BsonCollectionName collectionName = new BsonCollectionName("person"); Assert.IsInstanceOfType(collectionName, typeof(BsonCollectionName)); Assert.AreEqual("person", collectionName.Name); Assert.IsNotNull(collectionName.Name); }
internal void SetCollectionNameAndBsonId() { TypeInfo typeInfo = typeof(T).GetTypeInfo(); BsonCollectionName bsonCollectionName = (BsonCollectionName)typeInfo.GetCustomAttribute(typeof(BsonCollectionName)); CollectionName = bsonCollectionName != null ? bsonCollectionName.Name : typeof(T).Name.ToLower(); var id = typeInfo.GetProperties().Where(w => w.GetCustomAttribute(typeof(BsonIdAttribute)).GetType() == typeof(BsonIdAttribute)).FirstOrDefault(); BsonIdName = id?.Name; }