コード例 #1
0
ファイル: ITLastStep.cs プロジェクト: PRJ419/Back-end
        public void ChangeUserReview_AvgRatingChangedForBar()
        {
            var barController = new BarController(_uow, _mapper);

            barController.AddBar(new BarDto()
            {
                BarName          = "Bar1",
                AvgRating        = 0.0,
                ShortDescription = "SD",
                AgeLimit         = 18,
                CVR             = 1235,
                Image           = "png.jpg",
                LongDescription = "short",
                Address         = "123 street",
                Email           = "*****@*****.**",
                Educations      = "IKT",
                PhoneNumber     = 0000,
            });

            var customerController = new CustomerController(_uow, _mapper);

            customerController.AddCustomer(new CustomerDto
            {
                DateOfBirth   = DateTime.Now,
                Email         = "*****@*****.**",
                FavoriteBar   = "Bar1",
                FavoriteDrink = "Øl",
                Name          = "TestKunde",
                Username      = "******",
            });

            var reviewController = new ReviewController(_uow, _mapper);

            reviewController.AddUserReview(new ReviewDto()
            {
                BarName     = "Bar1",     // Bar added
                Username    = "******", // User added
                BarPressure = 5,          // Rating
            });                           // Add review
            reviewController.EditUserReview(new ReviewDto()
            {
                BarName     = "Bar1",
                Username    = "******",
                BarPressure = 1,
            }); // Edit it at a later time.

            var secondBarController = CreateBarController();
            var resultObj           = (secondBarController.GetBar("Bar1") as OkObjectResult).Value as BarDto;

            Assert.That(resultObj.AvgRating, Is.EqualTo(1));
        }
コード例 #2
0
        public void EditReview_CorrectInput_ReturnsCreated()
        {
            var result = uut.EditUserReview(defaultReviewDto);

            Assert.That(result, Is.TypeOf <CreatedResult>());
        }