public void WorkReportScheduler()
        {
            //Arrange
            var report = new WorkReport();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "123Ds", ProjectName = "Project1", SpentHours = 5
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "987Fc", ProjectName = "Project2", SpentHours = 3
            });

            var scheduler = new Scheduler();

            scheduler.AddEntry(new ScheduleTask {
                TaskId = 1, Content = "Do something now.", ExecuteOn = DateTime.Now.AddDays(5)
            });
            scheduler.AddEntry(new ScheduleTask {
                TaskId = 2, Content = "Don't forget to...", ExecuteOn = DateTime.Now.AddDays(2)
            });

            //Act
            Console.WriteLine(report.ToString());
            Console.WriteLine(scheduler.ToString());

            var saver = new FileSaver();

            saver.SaveToFile(@"Reports", "WorkReport.txt", report);
            saver.SaveToFile(@"Schedulers", "Schedule.txt", scheduler);

            //Assert
            Assert.True(File.Exists(@"Reports/WorkReport.txt"));
            Assert.True(File.Exists(@"Schedulers/Schedule.txt"));
        }
Пример #2
0
        static void Main(string[] args)
        {
            //Example.1 wrong
            wrong.EmployeeService employeeService = new wrong.EmployeeService
            {
                FirstName = "John",
                LastName  = "Deo"
            };
            employeeService.EmployeeRegistration(employeeService);

            //Example.1 right
            right.Employee employee =
                new right.Employee("pesho", "mitkov", "*****@*****.**");

            right.EmployeeServices.EmployeeService newEmplpoyeeRegistration =
                new right.EmployeeServices.EmployeeService();
            newEmplpoyeeRegistration.RegistrationEmployee(employee);

            //Example.2 right

            var report = new WorkReport();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "123Ds", ProjectName = "Project1", SpentHours = 5
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "987Fc", ProjectName = "Project2", SpentHours = 3
            });


            var saver = new FileSaver();

            //след тези подобрение може лесно да се добавят нови ф-сти. Например класа ScheduleTask
            var scheduler = new SingleResponsiblilityExample.RightVersion.WorkReport.Schedular();

            scheduler.AddEntry(new ScheduleTask
            {
                TaskId = 1, Content = "Do something now.", ExecuteOn = DateTime.Now.AddDays(5)
            });
            scheduler.AddEntry(new ScheduleTask
            {
                TaskId = 2, Content = "Don't forget to...", ExecuteOn = DateTime.Now.AddDays(2)
            });

            Console.WriteLine(report.ToString());
            Console.WriteLine(scheduler.ToString());

            saver.SaveToFile(@"Reports", "WorkReport.txt", report);
            saver.SaveToFile(@"Scheduler", "Scheduler.txt", scheduler);
        }
Пример #3
0
        static void Main(string[] args)
        {
            var report = new WorkReport();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "123Ds", ProjectName = "Project1", SpentHours = 5
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "987Fc", ProjectName = "Project2", SpentHours = 3
            });
            Console.WriteLine(report.ToString());
            var saver = new FileSaver();

            saver.SaveToFile(@"D:/", "WorkReport.txt", report);
        }
Пример #4
0
        private void MakeReport()
        {
            var report = new WorkReport();

            report.AddEntry(new Classes.WorkReportEntry {
                ProjectCode = codigo.Text, ProjectName = nombre_projecto.Text, SpectHours = Int32.Parse(hora.Text)
            });

            /*report.AddEntry(new Classes.WorkReportEntry { ProjectCode = "175EEE", ProjectName = "Name Test 2", SpectHours = 25 });
            *  report.AddEntry(new Classes.WorkReportEntry { ProjectCode = "858EWW", ProjectName = "Name Test 3", SpectHours = 35 });*/

            var scheduler = new Scheduler();

            scheduler.AddEntry(new Classes.ScheduleTask {
                TaskId = 1, Content = "Something todo", ExecuteON = DateTime.Now
            });
            scheduler.AddEntry(new Classes.ScheduleTask {
                TaskId = 2, Content = "Something todo againg", ExecuteON = DateTime.Now.AddDays(2)
            });

            Console.WriteLine(report.ToString());
            Console.WriteLine(scheduler.ToString());
            //TODO --> Separarlo add de save

            var saver = new FileSaver();

            saver.SaveToFile(@"Reports", "WorkReport.txt", report);
            saver.SaveToFile(@"Schedulers", "Schedule.txt", scheduler);
        }
Пример #5
0
        private void MakeReport()
        {
            var report = new WorkReport();

            report.AddEntry(new Classes.WorkReportEntry {
                ProjectCode = TIPOPLACA.Text + NUMEROPLACA.Text, ProjectName = LUGARINFRACCION.Text, SpectHours = Int32.Parse(HORA.Text)
            });


            var scheduler = new Scheduler();

            scheduler.AddEntry(new Classes.ScheduleTask {
                TaskId = 1, Content = "Something todo", ExecuteON = DateTime.Now
            });
            scheduler.AddEntry(new Classes.ScheduleTask {
                TaskId = 2, Content = "Something todo againg", ExecuteON = DateTime.Now.AddDays(2)
            });

            Console.WriteLine(report.ToString());
            Console.WriteLine(scheduler.ToString());
            //TODO --> Separarlo add de save

            var saver = new FileSaver();

            saver.SaveToFile(@"Reports", "RegistroMultas.txt", report);
            saver.SaveToFile(@"Schedulers", "Schedule.txt", scheduler);
        }
        public void WorkReportEntries()
        {
            //Arrange
            var report = new WorkReport();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "123Ds", ProjectName = "Project1", SpentHours = 5
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "987Fc", ProjectName = "Project2", SpentHours = 3
            });

            //Act
            Console.WriteLine(report.ToString());
            var saver = new FileSaver();

            saver.SaveToFile(@"Reports", "WorkReport.txt", report);

            //Assert
            Assert.True(File.Exists(@"Reports/WorkReport.txt"));
        }