/// <summary>
        /// Формирует набор данных, который необходимо протестировать
        /// </summary>
        /// <returns></returns>
        private async Task <IEnumerable <Employee> > ConstructTestResults()
        {
            var mockedSalaryGetter = new Mock <ISalaryGetter>();

            mockedSalaryGetter
            .Setup(mock => mock.GetSalary(It.IsAny <string>(), It.IsAny <string>()))
            .ReturnsAsync(MocksGenerator.GetRandomSalary());

            var mockedEmpCodeGetter = new Mock <IEmpCodeGetter>();

            mockedEmpCodeGetter
            .Setup(mock => mock.GetBuhCode(It.IsAny <string>()))
            .ReturnsAsync(MocksGenerator.GetRandomString());

            var mockedRepo = new Mock <IDatabaseRepository>();

            mockedRepo
            .Setup(mock => mock.GetAllEmployees())
            .ReturnsAsync(MocksGenerator.GetRandomEmployees(fillSalary: false));

            var testedEmployeeFillingService = new EmployeeFillingData(mockedRepo.Object, mockedSalaryGetter.Object, mockedEmpCodeGetter.Object);

            var testedResults = await testedEmployeeFillingService.GetEmployeesWithFilledData();

            return(testedResults);
        }
        public void TotalSalaryInfoIsCorrect()
        {
            var reportFormatter = new ReportFormatter();
            var empsByDepts     = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department);

            var expectedTotalSalaryInfo = $"{Environment.NewLine}{dividerLine}{Environment.NewLine}Всего по предприятию: {empsByDepts.Sum(dept => dept.Sum(emp => emp.Salary)).ToString("C")}";

            var factTotalSalaryInfo = reportFormatter.MakeTotalSalaryInfo(empsByDepts);

            Assert.AreEqual(expectedTotalSalaryInfo, factTotalSalaryInfo);
        }
        public void EmpSalaryInfoIsCorrect()
        {
            var reportFormatter = new ReportFormatter();
            var emp             = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First().First();

            var expectedSalaryInfo = $"{Environment.NewLine}{emp.Name}\t{emp.Salary.ToString("C")}";

            var factSalaryInfo = reportFormatter.MakeEmpSalaryInfo(emp);

            Assert.AreEqual(expectedSalaryInfo, factSalaryInfo);
        }
        public void DeptTitleIsCorrect()
        {
            var reportFormatter = new ReportFormatter();

            var deptInfo = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First();

            var expectedDeptTitle = $"{Environment.NewLine}{dividerLine}{Environment.NewLine}{deptInfo.Key}";

            var factDeptTitle = reportFormatter.MakeDeptTitle(deptInfo);

            Assert.AreEqual(expectedDeptTitle, factDeptTitle);
        }
        public void DeptSalaryInfoIsCorrect()
        {
            var reportFormatter = new ReportFormatter();

            var deptInfo = MocksGenerator.GetRandomEmployees(fillSalary: true).GroupBy(x => x.Department).First();

            var expectedDeptSalaryInfo = $"{Environment.NewLine}Всего по отделу: {deptInfo.Sum(x => x.Salary).ToString("C")}{Environment.NewLine}";

            var factDeptSalaryInfo = reportFormatter.MakeDeptSalaryInfo(deptInfo);

            Assert.AreEqual(expectedDeptSalaryInfo, factDeptSalaryInfo);
        }
        /// <summary>
        /// Формирование объекта контроллера для тестов
        /// </summary>
        /// <returns></returns>
        private ReportController ConstructController()
        {
            var mockedEmployeeWithFilledData = new Mock <IEmployeeFillingData>();

            mockedEmployeeWithFilledData
            .Setup(mock => mock.GetEmployeesWithFilledData())
            .ReturnsAsync(MocksGenerator.GetRandomEmployees(fillSalary: true));

            var mockedReportFormatter = new Mock <ReportFormatter>();
            var mockReportMaker       = new Mock <ReportMaker>(mockedEmployeeWithFilledData.Object, mockedReportFormatter.Object);

            var controller = new ReportController(mockReportMaker.Object);

            return(controller);
        }