public void ReadBySectionShouldReturnAllPanelsInSection() { //arrange FileSolarPanelRepository repo = new FileSolarPanelRepository("TestDataBLLRead.csv"); SolarPanelService service = new SolarPanelService(repo); Dictionary <string, SolarPanel> firstSection; Dictionary <string, SolarPanel> secondSection; ListOfPanelsResult firstResult = new ListOfPanelsResult(); ListOfPanelsResult secondResult = new ListOfPanelsResult(); //act firstResult = service.ReadBySection("Test1"); secondResult = service.ReadBySection("Test2"); firstSection = firstResult.Data; secondSection = secondResult.Data; //assert Assert.IsNotNull(firstSection); Assert.IsNotNull(secondSection); Assert.AreEqual(3, firstSection.Count); Assert.AreEqual(2, secondSection.Count); Assert.IsTrue(firstSection["Test1-100-3"].IsTracking); Assert.IsFalse(secondSection["Test2-1-3"].IsTracking); }
public void ReadBySectionShouldReturnNullAndFalseIfNotPresent() { //arrange FileSolarPanelRepository repo = new FileSolarPanelRepository("TestDataBLLRead.csv"); SolarPanelService service = new SolarPanelService(repo); Dictionary <string, SolarPanel> notASection; ListOfPanelsResult result = new ListOfPanelsResult(); //act result = service.ReadBySection("Test3"); notASection = result.Data; //assert Assert.IsNull(notASection); Assert.IsFalse(result.Success); Assert.AreEqual("No panels found in that section", result.Message); }
private void ReadBySection() { string section = ConsoleIO.PromptString("Section name"); ListOfPanelsResult result = _service.ReadBySection(section); ConsoleIO.Display($"Panels in {section}"); if (result.Success) { foreach (var panel in result.Data) { ConsoleIO.PrintPanel(panel.Value); } } else { ConsoleIO.Display(result.Message); } }