コード例 #1
0
        public void GetUsersRatingTypeForAPost_GetsCorrectRatingType()
        {
            // Arrange
            var context = this.ServiceProvider.GetRequiredService <WmipDbContext>();
            var user    = new User {
                Id = "4", UserName = "******"
            };

            context.Users.Add(user);
            context.SaveChanges();
            var ratingService = new RatingsService(context);

            // Act
            ratingService.Rate(1, user.Id, RatingType.Positive);
            var ratingType = ratingService.GetUsersRatingTypeForAPost(1, user.UserName);

            //Assert
            Assert.Equal(RatingType.Positive, ratingType);
        }