Exemplo n.º 1
0
        public void TestListAllPerformancesWhenDatabaseIsEmpty_ShouldReturnAnEmptyCollection()
        {
            // Arange
            int expectedResult = 0;

            // Act
            var result = database.ListAllPerformances();

            // Assert
            Assert.AreEqual(
                expectedResult,
                result.Count(),
                "ListAllPerformances method returned a collection of a wrong size.");
        }
        public void TestPrintEmptyPerformances()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();
            var performances = performanceDb.ListAllPerformances().ToList();

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

            var actualPerformances = database.ListAllPerformances();

            Assert.AreEqual(0, actualPerformances.Count());
        }
        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);
        }
        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 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 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 TestPrintEmptyPerformances()
 {
     IPerformanceDatabase performanceDb = new PerformanceDatabase();
     var performances = performanceDb.ListAllPerformances().ToList();
     Assert.AreEqual(0, performances.Count());
 }