示例#1
0
        public void RateBeer_ChangeRating_4()
        {
            //Arrange
            User newUser = new User("Bob");
            Beer newBeer = new Beer("Alpha IPA", 6.8, 70.0);

            newUser.Save();
            newBeer.Save();

            //Act
            newUser.RateBeer(newBeer.GetId(), 5);
            newUser.RateBeer(newBeer.GetId(), 4);
            float testRating = newBeer.GetRating();

            //Assert
            Assert.Equal(4.0, testRating);
        }
示例#2
0
        public void GetRating_GetAverageRatingForBeer_3()
        {
            //Arrange
            Beer newBeer = new Beer("Alpha IPA", 6.8, 70.0);
            User user1   = new User("Bob");
            User user2   = new User("Fred");

            newBeer.Save();
            user1.Save();
            user2.Save();

            //Act
            user1.RateBeer(newBeer.GetId(), 4);
            user2.RateBeer(newBeer.GetId(), 2);

            //Assert
            Assert.Equal(3.00F, newBeer.GetRating());
        }