public void FindAllReportsByManufacturerValid() { var database = new Database(); var manufacturer = "Bate gosho"; var model1 = "Kira96"; var model2 = "Pari +5 Sfag"; database.AddReport(new Report(manufacturer, model1, true)); database.AddReport(new Report("Bratqta biachi", "nenenenen", false)); database.AddReport(new Report(manufacturer, model2, true)); var command = new FindAllReportsByManufacturer(database, "Bate gosho"); var expected = command.Execute(); var real = new StringBuilder(); real.AppendFormat("Reports from {0}:{1}", manufacturer, Environment.NewLine) .AppendLine("Report") .AppendLine(new string('=', 20)) .AppendFormat("Manufacturer: {0}{1}", manufacturer, Environment.NewLine) .AppendFormat("Model: {0}{1}", model1, Environment.NewLine) .AppendFormat("Mark: Passed{0}", Environment.NewLine) .AppendLine(new string('=', 20)) .AppendLine("Report") .AppendLine(new string('=', 20)) .AppendFormat("Manufacturer: {0}{1}", manufacturer, Environment.NewLine) .AppendFormat("Model: {0}{1}", model2, Environment.NewLine) .AppendFormat("Mark: Passed{0}", Environment.NewLine) .AppendLine(new string('=', 20)); Assert.AreEqual(expected.Trim(), real.ToString().Trim()); }
public void FindAllReportsByManufacturerEmpty() { var database = new Database(); var command = new FindAllReportsByManufacturer(database, "Mene me nema w celata shema"); var expected = command.Execute(); var real = "No reports."; Assert.AreEqual(expected.Trim(), real.Trim()); }
public void FindAllReportsByManufacturerWithNonExistentManufacturerName() { var database = new Database(); database.AddReport(new Report("Bate gosho", "Kira96", true)); database.AddReport(new Report("Bratqta biachi", "Pari +5 Sfag", false)); var command = new FindAllReportsByManufacturer(database, "Mene me nema w celata shema"); var expected = command.Execute(); var real = "No reports."; Assert.AreEqual(expected.Trim(), real.Trim()); }
private string FindAllReportsByManufacturer(string manufacturer) { var command = new FindAllReportsByManufacturer(this.database, manufacturer); return command.Execute(); }