public void LoadTest() { var p = new MockPlanning(); var firstTask = new MockTask(); var secondTask = new MockTask(); int index = 10; p.currentDayIndex = index; p.SetContent(new List <IWeek> { new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { firstTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(), }), new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { secondTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(new List <AbstractTask> { new MockTask() }), }) }); var rm = new ConsoleRoadmap(p); rm.ShowRoadmap(); var loader = new PlanningLoader(); var json = loader.GetJson(p); AbstractPlanning loadedPlanningMemory = loader.LoadFromJson(json, typeof(MockPlanning)); Assert.IsNotNull(loadedPlanningMemory); Assert.IsNotNull(loadedPlanningMemory.GetDays()); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Loaded planning test.json"; loader.Save(path, loadedPlanningMemory); AbstractPlanning loadedPlanningWithFile = loader.Load(path, typeof(MockPlanning)); Assert.IsNotNull(loadedPlanningWithFile); Assert.IsNotNull(loadedPlanningMemory.GetDays()); File.Delete(path); Assert.AreEqual(index, p.currentDayIndex); }
public void SaveTest() { var p = new MockPlanning(); var firstTask = new MockTask(); var secondTask = new MockTask(); p.SetContent(new List <IWeek> { new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { firstTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(), }), new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { secondTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(new List <AbstractTask> { new MockTask() }), }) }); var rm = new ConsoleRoadmap(p); rm.ShowRoadmap(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Test save.json"; new PlanningLoader().Save(path, p); //File.Delete(path); }
public void PrintGetRoadmapTest() { var p = new MockPlanning(); var firstTask = new MockTask(); var secondTask = new MockTask(); p.SetContent(new List <IWeek> { new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { firstTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(), }), new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { secondTask, new MockTask() }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(new List <AbstractTask> { new MockTask() }), }) }); p.currentDayIndex = 13; var r = new ConsoleRoadmap(p); var text = r.GetRoadmapText(); Assert.IsNotNull(text); Console.WriteLine(text); }
public void PrintRoadmapTest() { var p = new MockPlanning(); var firstTask = new MockTask(); var secondTask = new MockTask(); p.SetContent(new List <IWeek> { new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { firstTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(), }), new IWeek(new List <AbstractDay> { new Day(new List <AbstractTask> { secondTask }), new Day(), new Day(), new Day(), new Day(), new Day(), new Day(new List <AbstractTask> { new MockTask() }), }) }); var rm = new ConsoleRoadmap(p); rm.ShowRoadmap(); p.currentDayIndex = 13; rm.ShowRoadmap(); }