public void MapToRecruitInfoTest() { var recruitInfoExpected = MemoryData.Build(1, 1, _photoExtension); var priz = SQLiteData.Build(1, 1, _photoExtension); var recruitInfoActual = RecruitInfoMapper.Map(priz); Assert.AreEqual(recruitInfoExpected, recruitInfoActual); }
public void MapToPrizTest() { var prizExpected = FirebirdData.Build(1); var recruitInfoInMemory = MemoryData.Build(1, 1, _photoExtension); var prizActual = RecruitInfoMapper.Map(recruitInfoInMemory); Assert.AreEqual(prizExpected, prizActual); }
public void GetByIdRecruitInfoSQLiteTest() { var recruitInfo = MemoryData.Build(1, 1, _photoExtension); AddRecruitInfo(recruitInfo); var first = _recruitInfoRepository.Get(1); Assert.IsNotNull(first); }
public void AddRecruitInfoSQLiteTest() { var recruitInfo = MemoryData.Build(1, 1, _photoExtension); AddRecruitInfo(recruitInfo); var expected = recruitInfo; var actual = _recruitInfoRepository.Get(1); Assert.AreEqual(expected, actual); }
public void Initialize() { _dbContextFactory = new DbContextTestFactory("PupaDbContextTest"); _dbContextCache = new DbContextCache(_dbContextFactory); _unitOfWorkFactory = new UnitOfWorkFactory(_dbContextCache); _prizQuery = new PrizQuery(_dbContextFactory); _prizCommand = new PrizCommand(_dbContextCache); _recruitInfoRepository = new RecruitInfoRepository(_prizQuery, _prizCommand); var priz = SQLiteData.Build(1, 1, _photoExtension); var recruitInfo = MemoryData.Build(1, 1, _photoExtension); }
public void GetByRcpConscriptionDateRecruitInfoSQLiteTest() { var recruitInfo1 = MemoryData.Build(1, 1, _photoExtension); var recruitInfo2 = MemoryData.Build(2, 2, _photoExtension); using (var unitOfWork = _unitOfWorkFactory.Create()) { _recruitInfoRepository.Add(recruitInfo1); _recruitInfoRepository.Add(recruitInfo2); unitOfWork.Commit(); } var recruitInfos = _recruitInfoRepository.Get("Барабинский", new DateTime(2017, 1, 1), null); Assert.IsTrue(recruitInfos.Count() == 2); }
public void RemoveRecruitInfoSQLiteTest() { var recruitInfo = MemoryData.Build(1, 1, _photoExtension); AddRecruitInfo(recruitInfo); var first = _recruitInfoRepository.Get(1); Assert.IsNotNull(first); using (var unitOfWork = _unitOfWorkFactory.Create()) { _recruitInfoRepository.Remove(1); unitOfWork.Commit(); } first = _recruitInfoRepository.Get(1); Assert.IsNull(first); }
public void UpdateRecruitInfoSQLiteTest() { var recruitInfo = MemoryData.Build(1, 1, _photoExtension); AddRecruitInfo(recruitInfo); var first = _recruitInfoRepository.Get(1); var homeNumber = "123"; first.Envelope.Contacts.ChangeHomeNumber(new PhoneNumber(homeNumber)); using (var unitOfWork = _unitOfWorkFactory.Create()) { _recruitInfoRepository.Change(first); unitOfWork.Commit(); } var updated = _recruitInfoRepository.Get(1); Assert.AreEqual(homeNumber, updated.Envelope.Contacts.HomeNumber.Value); }
public void MoveTest() { var recruitInfo1 = MemoryData.Build(1, 1, _photoExtension); var recruitInfo2 = MemoryData.Build(2, 2, _photoExtension); var recruitInfo3 = MemoryData.Build(3, 3, _photoExtension); using (var unitOfWork = _unitOfWorkFactory.Create()) { _transmitService.Move(new List <RecruitInfo>() { recruitInfo1, recruitInfo2, recruitInfo3 }); unitOfWork.Commit(); } var expectedCount = 3; var actualCount = _prizQuery.GetAll().Count(); Assert.AreEqual(expectedCount, actualCount); }
public void ExportRecruitToExcelTest() { var recruitInfo = MemoryData.Build(1, 1, _photoExtension); var recruitExporter = new RecruitExcelExporter(_abTemplateFilePath, _excelFilePath); recruitExporter.ExportRecruitInfoesToExcel(recruitInfo); Excel.Application excel = null; Excel.Workbooks workbooks = null; Excel.Workbook workbook = null; Excel.Sheets worksheets = null; Excel.Worksheet worksheet = null; Excel.Range range = null; try { var recruitWorksheetIndex = 2; excel = new Excel.Application(); excel.Visible = false; workbooks = excel.Workbooks; workbook = workbooks.Open(_excelFilePath); worksheets = workbook.Worksheets; worksheet = worksheets[recruitWorksheetIndex]; range = worksheet.Cells; CheckRecruitInfo(recruitInfo, range, columnIdx: 2); workbook.Close(); excel.Quit(); } finally { if (range != null) { Marshal.ReleaseComObject(range); } if (worksheet != null) { Marshal.ReleaseComObject(worksheet); } if (worksheets != null) { Marshal.ReleaseComObject(worksheets); } if (workbook != null) { Marshal.ReleaseComObject(workbook); } if (workbooks != null) { Marshal.ReleaseComObject(workbooks); } if (excel != null) { Marshal.ReleaseComObject(excel); } } }