public async Task Then_expected_methods_are_called_the_correct_times()
            {
                await _sut.QueryAsync(_query);

                Assert.Multiple(() =>
                {
                    _contextService.Received(_expectedContextManageCount).InitContext();
                    _contextService.Received(_expectedContextManageCount).ClearCurrentContext();
                    _query.Received(1).GetLoadedProperties();
                });
            }
Beispiel #2
0
        public void QueryAsync_WhenSpecificationIsNull_ThrowsArgumentNullException()
        {
            var contextRepo = new ContextRepository <IAuditedContext>(It.IsAny <IAuditedContext>(), It.IsAny <ILogger <IAuditedContext> >());
            var resolver    = It.IsAny <Func <IQueryable <object>, Task <object> > >();
            var exception   = Assert.ThrowsAsync <ArgumentNullException>(() => contextRepo.QueryAsync(null, resolver));

            Assert.AreEqual("Value cannot be null. (Parameter 'specification')", exception.Message);
        }
 public void When_calling_query_async_for_a_null_query_Then_an_exception_is_thrown()
 {
     Assert.That(() => _sut.QueryAsync(null), Throws.ArgumentNullException);
 }
Beispiel #4
0
        public void QueryAsync_WhenResolverIsNull_ThrowsArgumentNullException()
        {
            var contextRepo           = new ContextRepository <IAuditedContext>(It.IsAny <IAuditedContext>(), It.IsAny <ILogger <IAuditedContext> >());
            var mockLinqSpecificaiton = new Mock <LinqSpecification <object> >();
            var exception             = Assert.ThrowsAsync <ArgumentNullException>(() => contextRepo.QueryAsync <object, object>(mockLinqSpecificaiton.Object, null));

            Assert.AreEqual("Value cannot be null. (Parameter 'resolver')", exception.Message);
        }