public void GetItemsByCategory_with_invalid_data() { // arrange var mclient = GetMockClient(out Mock <IMongoCollection <PasswordStoreModel> > mcollection); var mrepo = new PassStoreMongo(mclient.Object); // act and assert Assert.Throws <ArgumentNullException>(() => mrepo.GetItemsByCategory(null) .GetAwaiter().GetResult()); }
public void GetItemsByCategory_with_valid_store_model() { // arrange var mclient = GetMockClient(out Mock <IMongoCollection <PasswordStoreModel> > mcollection); var mrepo = new PassStoreMongo(mclient.Object); // act var rslt = mrepo.GetItemsByCategory("key-217533") .GetAwaiter().GetResult(); // assert mclient.VerifyAll(); mcollection.Verify(mc => mc.AggregateAsync(It.IsAny <PipelineDefinition <PasswordStoreModel, PasswordsCategory> >(), default(AggregateOptions), default(CancellationToken)), Times.Once); }