Esempio n. 1
0
        public void TestListPerformancesByTheatre()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");
            performanceDb.AddPerformance("Theatre Sofia", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);
            performanceDb.AddPerformance("Theatre Sofia", "Dance Show", new DateTime(2015, 02, 24, 18, 00, 00), new TimeSpan(1, 20, 0), 8.00M);
            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);

            performanceDb.AddTheatre("Theatre 199");
            performanceDb.AddPerformance("Theatre 199", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);

            var actualPerformancesSofia = string.Join(
                ", ", performanceDb.ListPerformances("Theatre Sofia"));
            var expectedPerformancesSofia = "Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50), Performance(Theatre: Theatre Sofia; Title: Dance Show; StartDateTime: 24.02.2015 18:00, Duration: 01:20, Price: 8.00), Performance(Theatre: Theatre Sofia; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";

            Assert.AreEqual(expectedPerformancesSofia, actualPerformancesSofia);

            var actualPerformances199   = string.Join(", ", performanceDb.ListPerformances("Theatre 199"));
            var expectedPerformances199 = "Performance(Theatre: Theatre 199; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";

            Assert.AreEqual(expectedPerformances199, actualPerformances199);
        }
        public void TestPrintPerformancesOfNonExsistentTheatreShouldThrowException()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            IPerformanceDatabase database = new PerformanceDatabase();

            database.ListPerformances("Test");
        }
        public void TestAddDuplicateTheatresShouldThrowException()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre 199");
            performanceDb.AddTheatre("Theatre 199");
        }
        public void TestPrintEmptyPerformances()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            var performances = performanceDb.ListAllPerformances().ToList();

            Assert.AreEqual(0, performances.Count());
        }
        public void TestAddingPerformanceToNonExsitentTheatreShouldThrowException()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddPerformance("Theatre", "Title", new DateTime(2015, 1, 1, 19, 0, 0), new TimeSpan(1, 30, 0), 15.5m);
        }
 public void TestAddOverlappingPerformancesShouldThrowException()
 {
     IPerformanceDatabase performanceDb = new PerformanceDatabase();
     performanceDb.AddTheatre("Theatre Sofia");
     performanceDb.AddPerformance("Theatre Sofia", "Dances", new DateTime(2015, 2, 2, 19, 00, 00), new TimeSpan(1, 40, 0), 12.50M);
     performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 2, 2, 20, 00, 00), new TimeSpan(1, 30, 0), 14.50M);
 }
Esempio n. 7
0
        public void TestNoTheatresShouldReturnEmptyList()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            var actualTheatres = performanceDb.ListTheatres().ToList();

            Assert.AreEqual(0, actualTheatres.Count());
        }
        public void TestNoTheatresShouldReturnEmptyList()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            var actualTheatres = performanceDb.ListTheatres().ToList();

            Assert.AreEqual(0, actualTheatres.Count());
        }
Esempio n. 9
0
        public void TestListPerformances_NoPerformances_ShouldThrowException()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            performanceDatabase.AddTheatre("Theatre 199");

            performanceDatabase.ListPerformances("Theatre 199");
        }
        public void TestAddOverlappingPerformancesFirstAllDayShouldThrowException()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");
            performanceDb.AddPerformance("Theatre Sofia", "All Day Event", new DateTime(2015, 2, 2, 9, 00, 00), new TimeSpan(14, 00, 0), 12.50M);
            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 2, 2, 19, 00, 00), new TimeSpan(1, 30, 0), 12.50M);
        }
        public void TestAddDuplicateShouldThrowException()
        {
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddTheatre("Art Theatre");
            database.AddTheatre("Theatre 199");
            database.AddTheatre("Theatre 199");
        }
Esempio n. 12
0
        public static void Main()
        {
            IReader consoleReader = new ConsoleReader();
            IWriter consoleWriter = new ConsoleWriter();
            IPerformanceDatabase database = new PerformanceDatabase();
            IEngine engine = new Engine(consoleReader, consoleWriter, database);

            engine.Run();
        }
Esempio n. 13
0
        public static void Main()
        {
            IReader consoleReader         = new ConsoleReader();
            IWriter consoleWriter         = new ConsoleWriter();
            IPerformanceDatabase database = new PerformanceDatabase();
            IEngine engine = new Engine(consoleReader, consoleWriter, database);

            engine.Run();
        }
        public void TestPrintNoPerformancesShouldReturnEmptyList()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            IPerformanceDatabase database = new PerformanceDatabase();

            var actualPerformances = database.ListAllPerformances();

            Assert.AreEqual(0, actualPerformances.Count());
        }
Esempio n. 15
0
        public void TestAddTheatreShouldListTheatresCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            performanceDb.AddTheatre("Theatre Sofia");
            
            var expectedTheatres = new[] { "Theatre Sofia" };
            var actualTheatres = performanceDb.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
        public void TestAddTheatreShouldListTheatresCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");

            var expectedTheatres = new[] { "Theatre Sofia" };
            var actualTheatres   = performanceDb.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
Esempio n. 17
0
        public void ListTheatres_NonEmptyList_ShouldReturnAllTheaters()
        {
            var db = new PerformanceDatabase();

            db.AddTheatre("Othelo");
            db.AddTheatre("Romemo and Juliet");

            var results = db.ListTheatres();

            Assert.AreEqual(2, results.Count());
        }
        public void TestAddTheatreReturnsListsTheatresCorrectrly()
        {
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddTheatre("Test Theatre");

            var expectedTheatres = new[] { "Test Theatre" };
            var actualTheatres   = database.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
        public void TestAddSinglePerformanceShouldListPerformancesCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
            string actualPerformances = string.Join(", ", performanceDb.ListAllPerformances());

            string expectedPerformances = "Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50)";

            Assert.AreEqual(expectedPerformances, actualPerformances);
        }
        public void TestAddingPerformanceShouldReturnListCorrectrly()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddTheatre("Theatre");
            database.AddPerformance("Theatre", "Title", new DateTime(2015, 1, 1, 19, 0, 0), new TimeSpan(1, 30, 0), 15.5m);
            string actaulPerformances = string.Join(", ", database.ListAllPerformances());

            string expectedPerformances = "Performance(Theatre: Theatre, Title: Title, Date: 01.01.2015 19:00, Duration: 01:30, Price: 15.50)";

            Assert.AreEqual(actaulPerformances, expectedPerformances);
        }
Esempio n. 21
0
        public void TestListTheatresWithOneEntryInTheDatabase_ShouldReturnACollectionOfStrings()
        {
            // Arange
            var database = new PerformanceDatabase();

            // Act
            database.AddTheatre("Theatre Sofia");
            var result = database.ListTheatres() as ICollection;

            // Assert
            CollectionAssert.AllItemsAreInstancesOfType(
                result,
                typeof(string),
                "ListTheatres method returned a collection of a wrong type.");
        }
Esempio n. 22
0
        public void TestAddPerformance_NonExistingTheatre_ShouldThrow()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            const string PerformanceStartTimeFormat = "dd.MM.yyyy HH:mm";

            string   theatreName     = "Theatre 199";
            string   performanceName = "Duende";
            DateTime startDateTime   = DateTime.ParseExact("20.01.2015 20:00", PerformanceStartTimeFormat,
                                                           CultureInfo.InvariantCulture);
            TimeSpan duration    = TimeSpan.Parse("1:30");
            decimal  ticketPrice = 14.50m;

            performanceDatabase.AddPerformance(theatreName, performanceName, startDateTime, duration, ticketPrice);
        }
Esempio n. 23
0
        public void TestListTheatres_ShouldReturnListOfTheatres()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            performanceDatabase.AddTheatre("Ivan Vazov");
            performanceDatabase.AddTheatre("Theatre 199");

            List <string> testList = new List <string>();

            testList.Add("Ivan Vazov");
            testList.Add("Theatre 199");

            List <string> expectedList = performanceDatabase.ListTheatres().ToList();

            CollectionAssert.AreEqual(testList, expectedList, "ListTheatres() does not retrieve theatres properly.");
        }
        public void TestAddSeveralPerformancesShouldListPerformancesCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            performanceDb.AddTheatre("Theatre Sofia");
            performanceDb.AddTheatre("Theatre 199");

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
            performanceDb.AddPerformance("Theatre Sofia", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);
            performanceDb.AddPerformance("Theatre Sofia", "Dance Show", new DateTime(2015, 02, 24, 18, 00, 00), new TimeSpan(1, 20, 0), 8.00M);
            performanceDb.AddPerformance("Theatre 199", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);

            string actualPerformances = string.Join(", ", performanceDb.ListAllPerformances());

            string expectedPerformances = "Performance(Theatre: Theatre 199; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00), Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50), Performance(Theatre: Theatre Sofia; Title: Dance Show; StartDateTime: 24.02.2015 18:00, Duration: 01:20, Price: 8.00), Performance(Theatre: Theatre Sofia; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";
            Assert.AreEqual(expectedPerformances, actualPerformances);
        }
        public void TestPrintPerformancesForTheatreShouldReturnCorrectly()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddTheatre("First Theatre");
            database.AddPerformance("First Theatre", "Title1", new DateTime(2015, 01, 01, 18, 30, 00), new TimeSpan(01, 00, 00), 15m);
            database.AddPerformance("First Theatre", "Title2", new DateTime(2015, 01, 01, 20, 00, 00), new TimeSpan(01, 00, 00), 15m);

            database.AddTheatre("Second Theatre");
            database.AddPerformance("Second Theatre", "Title1", new DateTime(2015, 01, 01, 18, 30, 00), new TimeSpan(01, 00, 00), 15m);

            var actualPerformances = string.Join(", ", database.ListPerformances("Second Theatre"));
            var expected           = "Performance(Theatre: Second Theatre, Title: Title1, Date: 01.01.2015 18:30, Duration: 01:00, Price: 15.00)";

            Assert.AreEqual(actualPerformances, expected);
        }
Esempio n. 26
0
        public void TestAddPerformance_ShouldStorePerformanceToRepository()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            performanceDatabase.AddTheatre("Theatre 199");

            const string PerformanceStartTimeFormat = "dd.MM.yyyy HH:mm";

            string   theatreName1     = "Theatre 199";
            string   performanceName1 = "Duende";
            DateTime startDateTime1   = DateTime.ParseExact("20.01.2015 20:00", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration1    = TimeSpan.Parse("1:30");
            decimal  ticketPrice1 = 14.50m;

            string   theatreName2     = "Theatre 199";
            string   performanceName2 = "Hamlet";
            DateTime startDateTime2   = DateTime.ParseExact("21.01.2015 20:00", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration2    = TimeSpan.Parse("1:30");
            decimal  ticketPrice2 = 14.50m;

            performanceDatabase.AddPerformance(theatreName1, performanceName1, startDateTime1, duration1, ticketPrice1);
            performanceDatabase.AddPerformance(theatreName2, performanceName2, startDateTime2, duration2, ticketPrice2);

            var performancesList = performanceDatabase.ListPerformances("Theatre 199");

            IPerformance expectedResult1 = new Performance(
                theatreName1, performanceName1, startDateTime1, duration1, ticketPrice1);
            IPerformance expectedResult2 = new Performance(
                theatreName2, performanceName2, startDateTime2, duration2, ticketPrice2);
            var expectedResultsList = new List <IPerformance>();

            expectedResultsList.Add(expectedResult1);
            expectedResultsList.Add(expectedResult2);

            int index = 0;

            foreach (var performance in performancesList)
            {
                Assert.AreEqual(performance.ToString(), expectedResultsList[index].ToString(),
                                "AddPerformance() does not add performance.");
                index++;
            }
        }
        public void TestAddSeveralPerformancesShouldListPerformancesCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");
            performanceDb.AddTheatre("Theatre 199");

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
            performanceDb.AddPerformance("Theatre Sofia", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);
            performanceDb.AddPerformance("Theatre Sofia", "Dance Show", new DateTime(2015, 02, 24, 18, 00, 00), new TimeSpan(1, 20, 0), 8.00M);
            performanceDb.AddPerformance("Theatre 199", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);

            string actualPerformances = string.Join(", ", performanceDb.ListAllPerformances());

            string expectedPerformances = "Performance(Theatre: Theatre 199; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00), Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50), Performance(Theatre: Theatre Sofia; Title: Dance Show; StartDateTime: 24.02.2015 18:00, Duration: 01:20, Price: 8.00), Performance(Theatre: Theatre Sofia; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";

            Assert.AreEqual(expectedPerformances, actualPerformances);
        }
Esempio n. 28
0
        public void TestAddSeveralTheatresWithDuplicatesShouldListTheatresCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            performanceDb.AddTheatre("Theatre 199");
            performanceDb.AddTheatre("Theatre Sofia");
            try
            {
                performanceDb.AddTheatre("Theatre 199");
            }
            catch (DuplicateTheatreException)
            {
                // Do nothing -> this exception is expected
            }

            var expectedTheatres = new[] { "Theatre 199", "Theatre Sofia" };
            var actualTheatres = performanceDb.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
Esempio n. 29
0
        public void TestAddPerformance_OverlappingPerformances_ShouldThrow()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            const string PerformanceStartTimeFormat = "dd.MM.yyyy HH:mm";

            string   theatreName1     = "Theatre 199";
            string   performanceName1 = "Duende";
            DateTime startDateTime1   = DateTime.ParseExact("20.01.2015 20:00", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration1    = TimeSpan.Parse("1:30");
            decimal  ticketPrice1 = 14.50m;

            performanceDatabase.AddPerformance(theatreName1, performanceName1, startDateTime1, duration1, ticketPrice1);

            string   theatreName2     = "Theatre 199";
            string   performanceName2 = "Hamlet";
            DateTime startDateTime2   = DateTime.ParseExact("20.01.2015 21:29", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration2    = TimeSpan.Parse("1:30");
            decimal  ticketPrice2 = 14.50m;

            performanceDatabase.AddPerformance(theatreName2, performanceName2, startDateTime2, duration2, ticketPrice2);

            string   theatreName3     = "Theatre 199";
            string   performanceName3 = "Don Juan";
            DateTime startDateTime3   = DateTime.ParseExact("20.01.2015 19:10", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration3    = TimeSpan.Parse("1:30");
            decimal  ticketPrice3 = 14.50m;

            performanceDatabase.AddPerformance(theatreName3, performanceName3, startDateTime3, duration3, ticketPrice3);

            string   theatreName4     = "Theatre 199";
            string   performanceName4 = "Don Pedro";
            DateTime startDateTime4   = DateTime.ParseExact("20.01.2015 20:10", PerformanceStartTimeFormat,
                                                            CultureInfo.InvariantCulture);
            TimeSpan duration4    = TimeSpan.Parse("1:00");
            decimal  ticketPrice4 = 14.50m;

            performanceDatabase.AddPerformance(theatreName4, performanceName4, startDateTime4, duration4, ticketPrice4);
        }
        public void TestAddDuplicateTheatresShouldListTheatresCorrectrly()
        {
            IPerformanceDatabase database = new PerformanceDatabase();

            database.AddTheatre("Art Theatre");
            database.AddTheatre("Theatre 199");

            try
            {
                database.AddTheatre("Theatre 199");
            }
            catch (Exception)
            {
            }

            var expectedTheatres = new[] { "Art Theatre", "Theatre 199" };
            var actualTheatres   = database.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
        public void TestAddSeveralTheatresWithDuplicateShouldListTheatresCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre 199");
            performanceDb.AddTheatre("Theatre Sofia");
            try
            {
                performanceDb.AddTheatre("Theatre 199");
            }
            catch (DuplicateTheatreException)
            {
                // Do nothing -> this exception is expected
            }

            var expectedTheatres = new[] { "Theatre 199", "Theatre Sofia" };
            var actualTheatres   = performanceDb.ListTheatres().ToList();

            CollectionAssert.AreEqual(expectedTheatres, actualTheatres);
        }
Esempio n. 32
0
        public void AddTheatre_TwoTimes_ShouldReturnCountEqualsTwo()
        {
            var db = new PerformanceDatabase();

            db.AddTheatre("Othelo");
            db.AddTheatre("Romemo and Juliet");

            var actualResult = db.ListTheatres();

            List <string> expectedResult = new List <string>();

            expectedResult.Add("Othelo");
            expectedResult.Add("Romemo and Juliet");
            string b = expectedResult[0];

            int count = 0;

            foreach (var theatre in actualResult)
            {
                string expectedName = expectedResult[count];
                Assert.AreEqual(theatre, expectedName);
                count++;
            }
        }
Esempio n. 33
0
        public void TestListTheatres_NoTheatres_ShouldThrowException()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            performanceDatabase.ListTheatres();
        }
        public void TestAddPerformanceNonExistingTheatreShouldThrowException()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
        }
        public void TestListPerformancesInvalidTheatreShouldThrowException()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.ListPerformances("Theatre Sofia");
        }
 public void TestListPerformancesInvalidTheatreShouldThrowException()
 {
     IPerformanceDatabase performanceDb = new PerformanceDatabase();
     performanceDb.ListPerformances("Theatre Sofia");
 }
 public void TestPrintEmptyPerformances()
 {
     IPerformanceDatabase performanceDb = new PerformanceDatabase();
     var performances = performanceDb.ListAllPerformances().ToList();
     Assert.AreEqual(0, performances.Count());
 }
        public void TestAddPerformanceNonExistingTheatreShouldThrowException()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
        }
Esempio n. 39
0
 public void ListTheatres_EmptyList_ShouldThrow()
 {
     var database = new PerformanceDatabase();
     var theatres = database.ListTheatres();
 }
Esempio n. 40
0
 public void TestAddDuplicateTheatresShouldThrowException()
 {
     IPerformanceDatabase performanceDb = new PerformanceDatabase();
     performanceDb.AddTheatre("Theatre 199");
     performanceDb.AddTheatre("Theatre 199");
 }
        public void TestListPerformancesByTheatre()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            IPerformanceDatabase performanceDb = new PerformanceDatabase();

            performanceDb.AddTheatre("Theatre Sofia");
            performanceDb.AddPerformance("Theatre Sofia", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);
            performanceDb.AddPerformance("Theatre Sofia", "Dance Show", new DateTime(2015, 02, 24, 18, 00, 00), new TimeSpan(1, 20, 0), 8.00M);
            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);

            performanceDb.AddTheatre("Theatre 199");
            performanceDb.AddPerformance("Theatre 199", "Bella Donna", new DateTime(2015, 02, 24, 19, 30, 00), new TimeSpan(1, 20, 0), 10M);

            var actualPerformancesSofia = string.Join(
                ", ", performanceDb.ListPerformances("Theatre Sofia"));
            var expectedPerformancesSofia = "Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50), Performance(Theatre: Theatre Sofia; Title: Dance Show; StartDateTime: 24.02.2015 18:00, Duration: 01:20, Price: 8.00), Performance(Theatre: Theatre Sofia; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";
            Assert.AreEqual(expectedPerformancesSofia, actualPerformancesSofia);

            var actualPerformances199 = string.Join(", ", performanceDb.ListPerformances("Theatre 199"));
            var expectedPerformances199 = "Performance(Theatre: Theatre 199; Title: Bella Donna; StartDateTime: 24.02.2015 19:30, Duration: 01:20, Price: 10.00)";
            Assert.AreEqual(expectedPerformances199, actualPerformances199);
        }
        public void TestAddSinglePerformanceShouldListPerformancesCorrectly()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            performanceDb.AddTheatre("Theatre Sofia");

            performanceDb.AddPerformance("Theatre Sofia", "Hamlet", new DateTime(2015, 02, 23, 19, 00, 00), new TimeSpan(1, 45, 0), 12.50M);
            string actualPerformances = string.Join(", ", performanceDb.ListAllPerformances());

            string expectedPerformances = "Performance(Theatre: Theatre Sofia; Title: Hamlet; StartDateTime: 23.02.2015 19:00, Duration: 01:45, Price: 12.50)";
            Assert.AreEqual(expectedPerformances, actualPerformances);
        }