Exemple #1
0
        public void CheckIfDataIsCorrectFormat()
        {
            var sender = new ReadingFile();
            var data   = sender.ReadCsv();
            var stringInCorrectFormat = data.StartsWith("Date,Time");

            Assert.True(stringInCorrectFormat);
        }
Exemple #2
0
        public List <TimeRecord> GetAllrecordsBetweenDate(DateTime firstDate, DateTime SecondDate)
        {
            List <TimeRecord> timeRecords = new List <TimeRecord>();

            ReadingFile readFile = new ReadingFile();

            timeRecords.AddRange(readFile.ReadFromFile <TimeRecord>(Settings1.Default.PathToEmployeeJournal));
            timeRecords.AddRange(readFile.ReadFromFile <TimeRecord>(Settings1.Default.PathToFreelancerJournal));
            timeRecords.AddRange(readFile.ReadFromFile <TimeRecord>(Settings1.Default.PathToHeadJournal));

            timeRecords = timeRecords.Where(q => q.WorkingDate >= firstDate && q.WorkingDate <= SecondDate).OrderBy(q => q.WorkingDate).ToList();

            return(timeRecords);
        }
Exemple #3
0
        private void Open(DockState dockState = DockState.Document)
        {
            var existing = All.FirstOrDefault(i => i.Path == this.Path);

            if (existing != null)
            {
                existing.Container.Activate();
                return;
            }
            Editor = new Editor(this)
            {
                Font = Properties.Settings.Default.Font
            };
            if (ReadingFile != null)
            {
                ReadingFile.Invoke(this, EventArgs.Empty);
            }
            Application.DoEvents();
            if (Role == Roles.Main)
            {
                if (Main.SceneryPanel != null)
                {
                    Main.SceneryPanel.Dispose();
                }
                Reset();
                Main.SceneryPanel = new ProjectPanel(this);
            }
            Editor.LoadFromFile();
            (Main.WordWrapMenuItem as ToolStripMenuItem).Checked = Editor.WordWrap;
            Container = new EditorContainer(Editor, Main.DockPanel, dockState);
            Container.UpdateText();
            if (ReadingFileDone != null)
            {
                ReadingFileDone.Invoke(this, EventArgs.Empty);
            }
            Application.DoEvents();
            if (All.Count < 1)
            {
                var s = Properties.Settings.Default;
                s.LastOpenFile = Path;
                s.Save();
            }
            All.Add(this);
            Status.FileName = FileName;
        }
Exemple #4
0
        public void IfFileExists()
        {
            var path   = ReturnCsvPath("Footfall_DataSet.csv");
            var sender = new ReadingFile();

            if (File.Exists(path))
            {
                Assert.True(File.Exists(path));
            }

            var destinationTemp = Directory.GetCurrentDirectory() + "\\Temp folder" + @"\" + "Footfall_DataSet.csv";

            File.Copy(path, destinationTemp, true);
            File.Delete(path);

            var ex = Assert.Throws <FileNotFoundException>(() => sender.ReadCsv());

            Assert.Equal("The required file not found", ex.Message);

            File.Copy(destinationTemp, path, true);
            File.Delete(destinationTemp);
        }
Exemple #5
0
 public static IReading CreateDAL()
 {
     return(ReadingFile.GetInstance());
 }