public void Then_If_The_Entity_Does_Not_Exist_An_Exception_Is_Thrown()
        {
            _dataContext.Setup(x => x.Accounts.FindAsync(It.IsAny <long>()))
            .ReturnsAsync((Account)null);
            _dataContext.Setup(x => x.Database)
            .Returns(_dataFacade.Object);
            _accountRepository = new Data.Repository.AccountRepository(_dataContext.Object, Mock.Of <ILogger <Data.Repository.AccountRepository> >());

            Assert.ThrowsAsync <DbUpdateException>(() => _accountRepository.UpdateName(new Account {
                Id = 54, Name = "Test"
            }));

            //Assert
            _dataContext.Verify(x => x.SaveChanges(), Times.Never);
        }
        public async Task Then_The_Name_Of_The_Account_Is_Updated()
        {
            //Arrange
            var expectedAccountName = "New Test Name";
            var expectedAccount     = new Account
            {
                Id   = 123,
                Name = "Test"
            };

            _dataContext.Setup(x => x.Accounts.FindAsync(expectedAccount.Id))
            .ReturnsAsync(expectedAccount);
            _dataContext.Setup(x => x.Database)
            .Returns(_dataFacade.Object);
            _accountRepository = new Data.Repository.AccountRepository(_dataContext.Object, Mock.Of <ILogger <Data.Repository.AccountRepository> >());

            //Act
            await _accountRepository.UpdateName(new Account { Id = 123, Name = expectedAccountName });

            //Assert
            _dataContext.Verify(x => x.SaveChanges(), Times.Once);
            Assert.AreEqual(expectedAccountName, expectedAccount.Name);
        }