public void Test_AddPerformance_ShouldAddThePerformance() { theatreDatabase.AddTheatre("Theatre Sofia"); theatreDatabase.AddPerformance( "Theatre Sofia", "Bella Donna", new DateTime(2015, 01, 20, 20, 30, 00), new TimeSpan(0, 1, 0, 0), 12); string expectedOutput = "(Bella Donna, Theatre Sofia, 20.01.2015 20:30)"; string actualOutput = string.Join(", ", theatreDatabase.ListAllPerformances()); Assert.AreEqual(expectedOutput, actualOutput); }
private static string ExecuteAddTheatreCommand(string[] parameters) { string theatreName = parameters[0]; performanceDb.AddTheatre(theatreName); return(Constants.TheatreAddedMsg); }
private static string ExecuteAddTheatreCommand(string[] commandParameters) { string theatreName = commandParameters[0]; performanceDB.AddTheatre(theatreName); return("Theatre added"); }
private static string ExecuteAddTheatreCommand(string[] parameters) { string theatreName = parameters[0]; PerformanceDatabase.AddTheatre(theatreName); return(Constants.TheatreAddedMessage); }
public static string ExecuteAddTheatreCommand(string[] parameters, IPerformanceDatabase database) { string theatreName = parameters[0]; database.AddTheatre(theatreName); return "Theatre added"; }
public static string ExecuteAddTheatreCommand(string[] parameters, IPerformanceDatabase database) { string theatreName = parameters[0]; database.AddTheatre(theatreName); return("Theatre added"); }
private static string ExecuteAddTheatreCommmand(IReadOnlyList <string> parameters) { var theatreName = parameters[0]; Universal.AddTheatre(theatreName); return("Theatre added"); }
private string ExecuteAddTheatreCommand(string[] parameters) { string theatreName = parameters[1]; database.AddTheatre(theatreName); string successMessage = "Theatre added"; return(successMessage); }
public void Test_AddTheatre_ShouldAddTheatreCorrectly() { performanceDb.AddTheatre("Ivan Vazov National Theatre"); var expextedTheatres = new[] { "Ivan Vazov National Theatre" }; var actualTheatres = performanceDb.ListTheatres().ToList(); CollectionAssert.AreEqual(expextedTheatres, actualTheatres); }
public void Test_AddTheatre_ShouldAddTheTheatre() { string theatreName = "Theatre Sofia"; theatreDatabase.AddTheatre(theatreName); string[] expectedOutput = new[] { "Theatre Sofia" }; var actualOutput = theatreDatabase.ListTheatres().ToList(); CollectionAssert.AreEqual(expectedOutput, actualOutput); }
protected static void Main() { while (true) { var input = Console.ReadLine(); if (input == null) { return; } if (input != string.Empty) { var tokens = input.Split(new[] { '(', ',', ')' }, StringSplitOptions.RemoveEmptyEntries); var command = tokens[0]; var parameters = tokens.Skip(1).Select(p => p.Trim()).ToArray(); string message; try { switch (command) { case "AddTheatre": var theatreName = parameters[0]; Database.AddTheatre(theatreName); message = "Theatre added"; break; case "PrintAllTheatres": var theatres = Database.ListTheatres().ToList(); message = string.Join(", ", theatres); break; case "AddPerformance": theatreName = parameters[0]; var performanceTitle = parameters[1]; var startDateTime = DateTime.ParseExact( parameters[2], "dd.MM.yyyy HH:mm", CultureInfo.InvariantCulture); var duration = TimeSpan.Parse(parameters[3]); var price = decimal.Parse(parameters[4], NumberStyles.Float); Database.AddPerformance(theatreName, performanceTitle, startDateTime, duration, price); message = "Performance added"; break; case "PrintAllPerformances": var performances = Database.ListAllPerformances().ToList(); message = string.Join(", ", performances); break; case "PrintPerformances": theatreName = parameters[0]; var performancesPerTheatre = Database.ListPerformances(theatreName).ToList(); message = string.Join(", ", performancesPerTheatre); break; default: message = "Invalid command!"; break; } } catch (Exception ex) { message = "Error: " + ex.Message; } Console.WriteLine(message); } } }
internal static string ExecuteAddTheatreCommand(IPerformanceDatabase db, AddThratreCommand command) { db.AddTheatre(command.TheatreName); return "Theatre added"; }
public static void ExecuteAddTheatreCommand(string theatreName) { theatresDatabase.AddTheatre(theatreName); }