public OperationsRepository(
     IWorkingCopy workingCopy,
     ICsvAccountOperationManager csvAccountOperationManager,
     UnifiedAccountOperationPatternTransformer transactionPatternMapper)
 {
     _workingCopy = workingCopy;
     _csvAccountOperationManager = csvAccountOperationManager;
     _transactionPatternMapper   = transactionPatternMapper;
 }
Beispiel #2
0
        public async Task ThenAnEmptyListIsReturnedWhenSettingsFileDoesNotExist(
            AccountsRepository sut,
            IWorkingCopy workingCopy,
            Wrapper <string> inexistingSettingPath)
        {
            //Arrange
            Mock.Get(workingCopy).Setup(w => w.SettingsPath).Returns(inexistingSettingPath);

            //Act
            var accounts = await sut.GetList();

            // Assert
            accounts.Should().BeEmpty();
        }
Beispiel #3
0
        public async Task ThenAnEmptyListIsReturnedWhenReadingTheFileFails(
            AccountsRepository sut,
            IWorkingCopy workingCopy,
            IMockFileDataAccessor mockFileDataAccessor,
            Wrapper <string> existingSettingPath)
        {
            //Arrange
            mockFileDataAccessor.AddFile(existingSettingPath, new MockFileData("{ invalid json }"));
            Mock.Get(workingCopy).Setup(w => w.SettingsPath).Returns(existingSettingPath);

            //Act
            var accounts = await sut.GetList();

            // Assert
            accounts.Should().BeEmpty();
        }
Beispiel #4
0
        public async Task ThenStoredAccountsAreReturned(
            AccountsRepository sut,
            IWorkingCopy workingCopy,
            IMockFileDataAccessor mockFileDataAccessor,
            Wrapper <string> existingSettingPath,
            List <AccountEntity> existingEntities)
        {
            //Arrange
            var rawEntities = JsonConvert.SerializeObject(existingEntities);

            mockFileDataAccessor.AddFile(existingSettingPath, new MockFileData(rawEntities));
            Mock.Get(workingCopy).Setup(w => w.SettingsPath).Returns(existingSettingPath);

            //Act
            var accounts = await sut.GetList();

            // Assert
            accounts.Count.Should().Be(existingEntities.Count);
        }
 public AccountCommandRepository(IWorkingCopy workingCopy)
 {
     _workingCopy = workingCopy;
 }
 public AccountsRepository(IWorkingCopy workingCopy)
 {
     _workingCopy = workingCopy;
 }