Exemple #1
0
        public void SortConcertsBy_CorrectlySortByTime()
        {
            //Arrange
            var mockFestivalManager = new Mock <IFestivalManager>();
            var mockDataAcces       = new Mock <IDataAccess>();

            mockFestivalManager.Setup(f => f.Calendar).Returns(new Calendar(mockDataAcces.Object));
            CalendarModel Model = new CalendarModel(mockFestivalManager.Object)
            {
                Concerts = GenerateConcerts(),
                SortBy   = "Time"
            };

            Model.Concerts.Reverse();

            //Act
            var resultConcerts = Model.SortConcertBy(Model.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);
        }
Exemple #2
0
        public void SortConcertsBy_CorrectlySortByArtist()
        {
            //Arrange
            var mockFestivalManager = new Mock <IFestivalManager>();
            var mockDataAcces       = new Mock <IDataAccess>();

            mockFestivalManager.Setup(f => f.Calendar).Returns(new Calendar(mockDataAcces.Object));
            CalendarModel Model = new CalendarModel(mockFestivalManager.Object)
            {
                Concerts = GenerateConcerts(),
                SortBy   = "Artist"
            };

            //Act
            var resultConcerts = Model.SortConcertBy(Model.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);
        }