public void TestNoTheatresShouldReturnEmptyList()
        {
            IPerformanceDatabase performanceDb = new PerformanceDatabase();

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

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

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

            Assert.AreEqual(0, actualTheatres.Count());
        }
Example #3
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);
        }
        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);
        }
Example #6
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());
        }
Example #7
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.");
        }
Example #8
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.");
        }
Example #9
0
        public void TestListTheatresWhenDatabaseIsEmpty_ShouldReturnAnEmptyCollectionOfTypeString()
        {
            // Arange
            var expectedResult = new List <string>();

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

            // Assert
            Assert.AreEqual(
                expectedResult.Count,
                result.Count(),
                "ListTheatres method returned a collection with a non-zero Count.");
        }
Example #10
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);
        }
        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);
        }
        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);
        }
Example #13
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++;
            }
        }
Example #14
0
 public void ListTheatres_EmptyList_ShouldThrow()
 {
     var database = new PerformanceDatabase();
     var theatres = database.ListTheatres();
 }
Example #15
0
        public void TestListTheatres_NoTheatres_ShouldThrowException()
        {
            IPerformanceDatabase performanceDatabase = new PerformanceDatabase();

            performanceDatabase.ListTheatres();
        }