public async void GetForFilter_NonExistingMarkSessionModel_ReturnsNull() { // Arrange var markSessionFilterDefinition = new Mock <FilterDefinition <MarkSessionModel> >(); var markSessionModelAsyncCursor = new Mock <IAsyncCursor <MarkSessionModel> >(); var markSessionCollection = new Mock <IMongoCollection <MarkSessionModel> >(); markSessionCollection .Setup(m => m.FindAsync( It.IsAny <FilterDefinition <MarkSessionModel> >(), It.IsAny <FindOptions <MarkSessionModel, MarkSessionModel> >(), It.IsAny <CancellationToken>() )).ReturnsAsync(markSessionModelAsyncCursor.Object); var dbMongoService = new Mock <IDbMongoService>(); dbMongoService .Setup(m => m.GetMarkSessionCollection()) .Returns(markSessionCollection.Object); var markSessionRepository = new MarkSessionRepository(dbMongoService.Object); // Act var result = await markSessionRepository.GetForFilter(markSessionFilterDefinition.Object); // Assert Assert.Null(result); }
public async void GetForFilter_FilterIsExistingMarkSessionId_ReturnsMarkSessionModel() { // Arrange var filterDefinition = Builders <MarkSessionModel> .Filter.Eq( MarkSessionModel.BsomElementDefinitionId, new ObjectId("5b07decf7aa54a0007b3db51") ); var dbMongoService = new DbMongoService(); var markSessionRepository = new MarkSessionRepository(dbMongoService); // Act var result = await markSessionRepository.GetForFilter(filterDefinition); // Assert Assert.NotNull(result); }