public async Task Then_expected_methods_are_called_the_correct_times()
            {
                await _sut.GetAsync(_expectedEntity.FooId);

                Assert.Multiple(() =>
                {
                    _contextService.Received(_expectedContextManageCount).InitContext();
                    _contextService.Received(_expectedContextManageCount).ClearCurrentContext();
                    _dbSet.Received(1).FindAsync(_expectedEntity.FooId);
                });
            }
Example #2
0
        public void GetAsync_WhenSpecificationIsNull_ThrowsArgumentNullException()
        {
            var contextRepo = new ContextRepository <IAuditedContext>(It.IsAny <IAuditedContext>(), It.IsAny <ILogger <IAuditedContext> >());
            var exception   = Assert.ThrowsAsync <ArgumentNullException>(() => contextRepo.GetAsync <object>(null));

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