public async Task HasEnoughRating_Should_Throw_InvalidOperationException_When_The_User_Is_Not_Found() { using (MongoTestServer server = SetupServer()) { // ARRANGE var collection = server.Database.GetCollection <UserEntity>("users"); var service = new MyCounterService(collection); await collection.InsertOneAsync(new UserEntity { Id = ObjectId.GenerateNewId().ToString(), Name = "foo", Rating = 23 }); // ACT, ASSERT Assert.Throws <InvalidOperationException>( () => service.HasEnoughRating(ObjectId.GenerateNewId().ToString())); } }
public async Task HasEnoughRating_Should_Return_False_When_The_User_Has_100_Rating() { using (MongoTestServer server = SetupServer()) { // ARRANGE var collection = server.Database.GetCollection <UserEntity>("users"); var service = new MyCounterService(collection); var userId = ObjectId.GenerateNewId().ToString(); await collection.InsertOneAsync(new UserEntity { Id = userId, Name = "foo", Rating = 100 }); // ACT bool isEnough = service.HasEnoughRating(userId); // ASSERT Assert.False(isEnough); } }