Пример #1
0
 public void ShouldReturnSuccessStorageResultWhenSuccessful()
 {
     var inputModel = new AccountInfo {AccountNumber = 3000, AccountName = "Test", IsIncome = "Utgift", PartsReportCategory= "Udefinert", ResultReportCategory = "Udefinert", WeekCategory = "Udefinert", Year = 2011};
     var toDb = new AccountInfoDTO {AccountNumber = 3000, AccountName = "Test", IsIncome = false, PartsReportCategory = 0, ResultReportCategory = 0, WeekCategory = 0, Year = 2011};
     _accountInfoRepositoryMock.Setup(x => x.SaveOne(toDb)).Returns(StorageResult.Success);
     var result = _subject.SaveOneAccountInfo(inputModel);
     Assert.That(result, Is.EqualTo(StorageResult.Success));
 }
Пример #2
0
 public void UpdateOneAccountInfo(AccountInfo accountInfo)
 {
     _accountInfoRepository.UpdateOne(MapOneForDataBase(accountInfo));
 }
Пример #3
0
 public AccountInfoDTO MapOneForDataBase(AccountInfo account)
 {
     return new AccountInfoDTO
     {
         Id = account.Id,
         AccountNumber = account.AccountNumber,
         AccountName = account.AccountName,
         ResultReportCategory = (int)Enum.Parse(typeof(ResultReportCategory), account.ResultReportCategory),
         PartsReportCategory = (int)Enum.Parse(typeof(PartsReportCategory), account.PartsReportCategory),
         WeekCategory = (int)Enum.Parse(typeof(WeekCategory), account.WeekCategory),
         IsIncome = Convert.ToBoolean((int)Enum.Parse(typeof(IsIncome), account.IsIncome)),
         Year = account.Year
     };
 }
Пример #4
0
 public StorageResult SaveOneAccountInfo(AccountInfo accountInfo)
 {
     return _accountInfoRepository.SaveOne(MapOneForDataBase(accountInfo));
 }