コード例 #1
0
        public void AddPerformance_ExistingOverlapTheatre_ShouldThrow()
        {
            var database = new PerformanceDatabase();

            database.AddTheatre("Sofiq");
            database.AddPerformance("Sofiq", "Vecher", DateTime.Now, TimeSpan.Parse("3600"), 10m);

            database.AddPerformance("Sofiq", "Vecher", DateTime.Now, TimeSpan.Parse("36000"), 10m);
        }
コード例 #2
0
        public void ListPerformances_ExistingTheatres_ShouldReturnCollection()
        {
            const string TheatreName = "Sofiq";
            const string Performance = "Vecher";
            const decimal TicketPrice = 15.50m;

            DateTime startDate = new DateTime(2015, 2, 4, 8, 30, 0);
            TimeSpan duration = new TimeSpan(0, 2, 30, 00);

            var database = new PerformanceDatabase();

            database.AddTheatre(TheatreName);
            database.AddPerformance(TheatreName, Performance, startDate, duration, TicketPrice);

            var result = database.ListPerformances(TheatreName).First();

            Assert.AreEqual(TheatreName, result.TheatreName);
            Assert.AreEqual(Performance, result.Performances);
            Assert.AreEqual(startDate, result.StartDate);
            Assert.AreEqual(duration, result.Duration);
            Assert.AreEqual(TicketPrice, result.TicketPrice);
        }