Exemplo n.º 1
0
        private DriverRatingService CreateDriverRatingService()
        {
            var userId        = Guid.Parse(User.Identity.GetUserId());
            var ratingService = new DriverRatingService(userId);

            return(ratingService);
        }
Exemplo n.º 2
0
        public void TestAddDriverRating()
        {
            //Arrange
            var mock = new Mock <IGenericRepository>();

            mock.Setup(x => x.Query <ApplicationUser>()).Returns(users.AsQueryable());
            var driverRatingService = new DriverRatingService(mock.Object);
            var ratingDriverTest    = new RatingDriver()
            {
                ConditionOfReturnedCar  = 4,
                DeliveryExperience      = 3,
                PaymentExperience       = 4,
                ProfessionalismOfDriver = 5,
                PromptReplies           = 4,
                SchedulingExperience    = 3,
                Trustworthiness         = 5
            };

            //Act
            var result = driverRatingService.CalculateDriverRating(this.user, ratingDriverTest);

            //Assert
            Assert.Equal(result, 4m);
        }