Пример #1
0
        public void SortConcertsBy_CorrectlySortByArtist()
        {
            //Arrange
            var            mockFestivalManager = new Mock <IFestivalManager>();
            var            mockDataAcces       = new Mock <IDataAccess>();
            VenuePageModel p1 = new VenuePageModel(mockFestivalManager.Object)
            {
                Concerts = GenerateConcerts(),
                SortBy   = "Artist"
            };

            //Act
            var resultConcerts = p1.SortConcerts(p1.Concerts);

            //Assert
            Assert.Equal("1Artist", resultConcerts[0].Artist);
            Assert.Equal("2Artist", resultConcerts[1].Artist);
            Assert.Equal("3Artist", resultConcerts[2].Artist);
            Assert.Equal("4Artist", resultConcerts[3].Artist);
            Assert.Equal("5Artist", resultConcerts[4].Artist);
        }
Пример #2
0
        public void SortConcertsBy_CorrectlySortByTime()
        {
            //Arrange
            var            mockFestivalManager = new Mock <IFestivalManager>();
            var            mockDataAcces       = new Mock <IDataAccess>();
            VenuePageModel p1 = new VenuePageModel(mockFestivalManager.Object)
            {
                Concerts = GenerateConcerts(),
                SortBy   = "Time"
            };

            p1.Concerts.Reverse();

            //Act
            var resultConcerts = p1.SortConcerts(p1.Concerts);

            //Assert
            Assert.Equal(0, resultConcerts[0].ID);
            Assert.Equal(1, resultConcerts[1].ID);
            Assert.Equal(2, resultConcerts[2].ID);
            Assert.Equal(3, resultConcerts[3].ID);
            Assert.Equal(4, resultConcerts[4].ID);
        }