public void DepartmentSummariesAreCorrect() { var content = new EmployeeTxtReportGenerator().GenerateContent(string.Empty, Departments); Assert.IsTrue(content.Contains("Всего по отделу 6р")); Assert.IsTrue(content.Contains("Всего по отделу 9р")); }
public void ReportContentIsCorrect() { var department = new Department { Name = "DPT", EmployeeList = new List <Employee> { new Employee { Salary = 1, Name = "TEST" } } }; var content = new EmployeeTxtReportGenerator().GenerateContent("Тест", new List <Department> { department }); var expected = $"Тест{Environment.NewLine}" + $"--------------------------------------------{Environment.NewLine}" + $"DPT{Environment.NewLine}" + $"TEST 1р{Environment.NewLine}" + $"Всего по отделу 1р{Environment.NewLine}" + $"--------------------------------------------{Environment.NewLine}" + "Всего по предприятию 1р"; Assert.AreEqual(content, expected); }
public ReportResult Build(int year, int month) { var reportName = MonthNameResolver.MonthName.GetName(year, month); var data = _employeeReportDataProvider.GetReportData(); var reportContent = new EmployeeTxtReportGenerator().GenerateContent(reportName, data); return(new ReportResult { ContentType = "application/octet-stream", Name = "report.txt", Data = System.Text.Encoding.UTF8.GetBytes(reportContent) }); }
public void OverallSummaryIsCorrect() { var content = new EmployeeTxtReportGenerator().GenerateContent(string.Empty, Departments); Assert.AreEqual(content.Split(Environment.NewLine).Last(), "Всего по предприятию 15р"); }
public void OverallSummaryExists() { var content = new EmployeeTxtReportGenerator().GenerateContent(string.Empty, employeeReportDataProvider.GetReportData()); Assert.IsTrue(content.Contains("Всего по предприятию 80000р")); }