예제 #1
0
        public void HaveChampion()
        {
            List <Movie> moviesExpected = new List <Movie>()
            {
                new Movie()
                {
                    titulo = "Beyblade", nota = 2
                },
                new Movie()
                {
                    titulo = "Destructive", nota = 4
                },
                new Movie()
                {
                    titulo = "Avengers", nota = 3
                },
                new Movie()
                {
                    titulo = "Cars", nota = 5
                }
            };
            ChampionshipBus championshipBus = new ChampionshipBus();

            championshipBus.RankedList(moviesExpected);
        }
        public async Task <ActionResult <List <Movie> > > Post([FromBody] List <Movie> movies)
        {
            ChampionshipBus championshipBus = new ChampionshipBus();

            var rankedMovies = await championshipBus.RankedList(movies);

            return(rankedMovies);
        }
예제 #3
0
        public async void HaveToWinWhoHasHighestGrade()
        {
            Movie movieA = new Movie()
            {
                nota = 2
            };
            Movie movieB = new Movie()
            {
                nota = 5
            };
            ChampionshipBus championshipBus = new ChampionshipBus();

            Movie winningMovie = await championshipBus.GetWinner(movieA, movieB);

            movieB.ToExpectedObject().ShouldMatch(winningMovie);
        }
예제 #4
0
        public async void ChampionshipHasToHaveEqualEightMovies(int quantityElements)
        {
            int          numberParticipants = 8;
            List <Movie> movies             = new List <Movie>();

            for (int i = 0; i < quantityElements; i++)
            {
                movies.Add(new Movie());
            }
            ChampionshipBus championshipBus = new ChampionshipBus();

            var message = Assert.ThrowsAsync <InvalidOperationException>(() =>
                                                                         championshipBus.ValidListQuantity(movies)).Result.Message;

            Assert.Equal(message, Message.Message.ChampionshipMessage.NumberParticipantsShouldBeEqual(numberParticipants));
        }
예제 #5
0
        public async void HaveToWinWhoHasTitleFirstInAlphabeticalOrder()
        {
            Movie movieA = new Movie()
            {
                nota = 3, titulo = "Beethoven"
            };
            Movie movieB = new Movie()
            {
                nota = 3, titulo = "Assassins Creed"
            };
            ChampionshipBus championshipBus = new ChampionshipBus();

            Movie winningMovie = await championshipBus.GetWinner(movieA, movieB);

            movieB.ToExpectedObject().ShouldMatch(winningMovie);
        }