Ejemplo n.º 1
0
        public async Task CreateReview_WithNullOrEmptyArguments_ShouldThrowAnArgumentException(string ownerId, string creatorId, string content)
        {
            //Arrange
            var expectedErrorMessage = "Some of the arguments are null or empty!";
            var moqUsersService      = new Mock <IUsersService>();
            var context = InitializeContext.CreateContextForInMemory();

            reviewsService = new ReviewsService(context, moqUsersService.Object);


            //Assert and act
            var ex = await Assert.ThrowsAsync <ArgumentException>(() =>
                                                                  reviewsService.CreateReview(ownerId, creatorId, content, 1));

            Assert.Equal(expectedErrorMessage, ex.Message);
        }
Ejemplo n.º 2
0
        public async Task CreateReview_WithOwnerEqualToCreator_ShouldThrowAnInvalidOperationException()
        {
            //Arrange
            var expectedErrorMessage = "Seller of the ad can't leave reviews for his ads!";

            var moqUsersService = new Mock <IUsersService>();
            var context         = InitializeContext.CreateContextForInMemory();

            reviewsService = new ReviewsService(context, moqUsersService.Object);


            //Assert and act
            var ex = await Assert.ThrowsAsync <InvalidOperationException>(() =>
                                                                          reviewsService.CreateReview("CreatorId", "CreatorId", "Content", 3));

            Assert.Equal(expectedErrorMessage, ex.Message);
        }
Ejemplo n.º 3
0
        public async Task CreateReview_WithRatingOutOfRange_ShouldThrowAnArgumentException(int rating)
        {
            //Arrange
            var expectedErrorMessage = "The rating must be in range between 1 and 5";

            var moqUsersService = new Mock <IUsersService>();
            var context         = InitializeContext.CreateContextForInMemory();

            reviewsService = new ReviewsService(context, moqUsersService.Object);


            //Assert and act
            var ex = await Assert.ThrowsAsync <ArgumentException>(() =>
                                                                  reviewsService.CreateReview("OwnerId", "CreatorId", "Content", rating));

            Assert.Equal(expectedErrorMessage, ex.Message);
        }
Ejemplo n.º 4
0
 public ManageController(
     UserManager <User> userManager,
     SignInManager <User> signInManager,
     IEmailSender emailSender,
     ILogger <ManageController> logger,
     UrlEncoder urlEncoder,
     IReviewsService reviews,
     IAppointmetsService appointments)
 {
     this.userManager   = userManager;
     this.signInManager = signInManager;
     this.emailSender   = emailSender;
     this.logger        = logger;
     this.urlEncoder    = urlEncoder;
     this.reviews       = reviews;
     this.appointments  = appointments;
 }
Ejemplo n.º 5
0
 public MediaController(IMediaService mediaService,
                        IMovieAPIService apiService,
                        IWebHostEnvironment webHostEnvironment,
                        IReviewsService reviewsService,
                        IUserService userService,
                        IAuthorizationService authorizationService,
                        UserManager <ApplicationUser> userManager,
                        IMediaEditService mediaEditService)
 {
     this.mediaService         = mediaService;
     this.userManager          = userManager;
     this.webHostEnvironment   = webHostEnvironment;
     this.apiService           = apiService;
     this.reviewsService       = reviewsService;
     this.userService          = userService;
     this.authorizationService = authorizationService;
     this.mediaEditService     = mediaEditService;
 }
Ejemplo n.º 6
0
        public HomePresenter(IHomeView view, IUsersService usersService, IReviewsService reviewsService) : base(view)
        {
            if (usersService == null)
            {
                throw new ArgumentNullException(string.Format(NullDependencyErrorMessage, nameof(usersService)));
            }

            if (reviewsService == null)
            {
                throw new ArgumentNullException(string.Format(NullDependencyErrorMessage, nameof(reviewsService)));
            }

            this.reviewsService = reviewsService;
            this.usersService   = usersService;

            this.View.GetTopUsers   += View_MyInit;
            this.View.GetTopReviews += View_GetTopReviews;
        }
Ejemplo n.º 7
0
        public async Task RemoveReviewFromItemAsync_CustomerIDAndReviewID_Null()
        {
            // arrange
            int customerID = 2;
            int reviewID   = 5;

            using (var context = new ApplicationDbContext(_options))
            {
                _service = new ReviewsService(context);

                // act
                await _service.RemoveReviewFromItemAsync(customerID, reviewID);

                var result = context.Find <Customer>(customerID).Reviews.FirstOrDefault();

                // assert
                Assert.That(result is null);
            }
        }
Ejemplo n.º 8
0
        public async Task GetReviewsBindingModelByUserId_WithEmptyOrNullUserId_ShouldThrowAnArgumentException()
        {
            //Arrange
            var expectedErrorMessage = "User id can't be null or empty!";
            var moqUsersService      = new Mock <IUsersService>();
            var context = InitializeContext.CreateContextForInMemory();

            reviewsService = new ReviewsService(context, moqUsersService.Object);


            //Assert and act
            var ex = await Assert.ThrowsAsync <ArgumentException>(() =>
                                                                  reviewsService.GetReviewsBindingModelByUserId(string.Empty, GlobalConstants.DefaultPageNumber, GlobalConstants.DefaultPageSize));

            var ex2 = await Assert.ThrowsAsync <ArgumentException>(() =>
                                                                   reviewsService.GetReviewsBindingModelByUserId(null, GlobalConstants.DefaultPageNumber, GlobalConstants.DefaultPageSize));

            Assert.Equal(expectedErrorMessage, ex.Message);
            Assert.Equal(expectedErrorMessage, ex2.Message);
        }
Ejemplo n.º 9
0
        public AdministrationController(IPlaceService placeService, IReviewsService reviewService,
                                        IAuthenticationProvider authProvider, IUserService userService,
                                        IQuestionService questionService, IViewModelFactory factory)
        {
            if (placeService == null)
            {
                throw new ArgumentNullException(nameof(placeService));
            }

            if (reviewService == null)
            {
                throw new ArgumentNullException(nameof(reviewService));
            }

            if (authProvider == null)
            {
                throw new ArgumentNullException(nameof(authProvider));
            }

            if (userService == null)
            {
                throw new ArgumentNullException(nameof(userService));
            }

            if (questionService == null)
            {
                throw new ArgumentNullException(nameof(questionService));
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            this.placeService    = placeService;
            this.reviewService   = reviewService;
            this.userService     = userService;
            this.questionService = questionService;
            this.authProvider    = authProvider;
            this.factory         = factory;
        }
Ejemplo n.º 10
0
        public PlacesController(IAuthenticationProvider authProvider, IViewModelFactory factory,
                                IPlaceService placeService, IAddressService addressService, ITablesService tablesService,
                                IReviewsService reviewsService)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            if (authProvider == null)
            {
                throw new ArgumentNullException(nameof(authProvider));
            }

            if (placeService == null)
            {
                throw new ArgumentNullException(nameof(placeService));
            }

            if (addressService == null)
            {
                throw new ArgumentNullException(nameof(addressService));
            }

            if (tablesService == null)
            {
                throw new ArgumentNullException(nameof(tablesService));
            }

            if (reviewsService == null)
            {
                throw new ArgumentNullException(nameof(reviewsService));
            }

            this.viewModelFactory = factory;
            this.authProvider     = authProvider;
            this.placeService     = placeService;
            this.addressService   = addressService;
            this.tablesService    = tablesService;
            this.reviewsService   = reviewsService;
        }
Ejemplo n.º 11
0
 public ProductsController(
     IMapper mapper,
     IProductsService productsService,
     ICategoriesService categoriesService,
     IIngredientsService ingredientsService,
     IReviewsService reviewsService,
     IProductsIngredientsService productsIngredientsService,
     IUsersLikesService usersLikesService,
     IOrdersService ordersService,
     IHubContext <ProductsHub, IProductsHubClient> productHubContext)
 {
     this._mapper                     = mapper;
     this._productsService            = productsService;
     this._categoriesService          = categoriesService;
     this._ingredientsService         = ingredientsService;
     this._reviewsService             = reviewsService;
     this._productsIngredientsService = productsIngredientsService;
     this._usersLikesService          = usersLikesService;
     this._ordersService              = ordersService;
     this._productsHubContext         = productHubContext;
 }
Ejemplo n.º 12
0
        public ReviewsController(IReviewsService reviewsService, IPlaceService placeService,
                                 IDateTimeProvider dateTimeProvider)
        {
            if (reviewsService == null)
            {
                throw new ArgumentNullException(nameof(reviewsService));
            }

            if (placeService == null)
            {
                throw new ArgumentNullException(nameof(placeService));
            }

            if (dateTimeProvider == null)
            {
                throw new ArgumentNullException(nameof(dateTimeProvider));
            }

            this.reviewsService   = reviewsService;
            this.placeService     = placeService;
            this.dateTimeProvider = dateTimeProvider;
        }
        public BarController(IMappingService mappingService,
                             IBarsService barsService,
                             IReviewsService reviewsService,
                             IRatingService ratingService,
                             IUserProvider userProvider)
        {
            if (mappingService == null)
            {
                throw new ArgumentNullException("Mapping service cannot be null.");
            }

            if (barsService == null)
            {
                throw new ArgumentNullException("Bars service cannot be null.");
            }

            if (reviewsService == null)
            {
                throw new ArgumentNullException("Reviews service cannot be null.");
            }

            if (ratingService == null)
            {
                throw new ArgumentNullException("Rating service cannot be null.");
            }

            if (userProvider == null)
            {
                throw new ArgumentNullException("User provider cannot be null.");
            }

            this.mappingService = mappingService;
            this.barsService    = barsService;
            this.reviewsService = reviewsService;
            this.ratingService  = ratingService;
            this.userProvider   = userProvider;
        }
Ejemplo n.º 14
0
 public ReviewsController(IMoviesService moviesService, IReviewsService reviewsService)
 {
     this.moviesService = moviesService;
     this.reviewsService = reviewsService;
 }
Ejemplo n.º 15
0
 public MoviesController(IMoviesService moviesService, IGenresMovieService genresMovieService, IReviewsService reviewsService, IRepository <MoviesUser> favouriteMovieRepository, IProfilePicturesService profilePicturesService)
 {
     this.moviesService            = moviesService;
     this.genresMovieService       = genresMovieService;
     this.reviewsService           = reviewsService;
     this.favouriteMovieRepository = favouriteMovieRepository;
     this.profilePicturesService   = profilePicturesService;
 }
 public HomeController(IProductsService productsService, IReviewsService reviewsService, IArticlesService articlesService)
 {
     this._productsService = productsService;
     this._reviewsService  = reviewsService;
     this._articlesService = articlesService;
 }
Ejemplo n.º 17
0
 public ReviewsController(IReviewsService reviewService, IMediaService mediaService, UserManager <ApplicationUser> userManager)
 {
     this.reviewService = reviewService;
     this.mediaService  = mediaService;
     this.userManager   = userManager;
 }
Ejemplo n.º 18
0
 public ReviewsController(IReviewsService reviewsService)
 {
     this.reviewsService = reviewsService;
 }
Ejemplo n.º 19
0
 public ReviewsController(IReviewsService reviewsService, IUsersService usersService)
 {
     this._reviewsService = reviewsService;
     this._usersService   = usersService;
 }
Ejemplo n.º 20
0
 public void TearDown()
 {
     _service = null;
 }
Ejemplo n.º 21
0
 public ReviewController(IReviewsService _service, IBeerService _beerService, IUsersService _usersService)
 {
     this._service     = _service ?? throw new ArgumentNullException("Service not found");
     this._beerService = _beerService ?? throw new ArgumentNullException("Service not found");
     this._userService = _usersService ?? throw new ArgumentNullException("Service not found");
 }
Ejemplo n.º 22
0
 public ReviewContainersController(IReviewsService reviewsService, IReviewsRepository sqlReviewsRepository)
 {
     _reviewsService       = reviewsService;
     _sqlReviewsRepository = sqlReviewsRepository;
 }
 public DessertReviewsViewComponent(IReviewsService reviewsService)
 {
     this.reviewsService = reviewsService;
 }
Ejemplo n.º 24
0
 public Task <List <Review> > Reviews([Service] IReviewsService reviews) => reviews.GetReviews(_id);
Ejemplo n.º 25
0
 public ReviewsController(IReviewsService reviews)
 {
     _reviews = reviews;
 }
Ejemplo n.º 26
0
 public FilmsService(ICatalogueService catalogueService, IMetadataService metadataService, IReviewsService reviewsService)
 {
     _catalogueService = catalogueService;
     _metadataService  = metadataService;
     _reviewsService   = reviewsService;
 }
Ejemplo n.º 27
0
 public ReviewsController(IReviewsService reviews, UserManager <User> userManager)
 {
     this.reviews     = reviews;
     this.userManager = userManager;
 }
Ejemplo n.º 28
0
 public ReviewsController(IReviewsService reviewsService, IMapper mapper)
 {
     this.reviewsService = reviewsService;
     this.mapper         = mapper;
 }
Ejemplo n.º 29
0
 public ReviewsController(IReviewsService reviews, ICategoriesService categories, IFilesService files)
 {
     this.reviews = reviews;
     this.categories = categories;
     this.files = files;
 }
Ejemplo n.º 30
0
 public ProductsController(IProductsService productsService, IReviewsService reviewsService)
 {
     this.productsService = productsService;
     this.reviewsService  = reviewsService;
 }
Ejemplo n.º 31
0
 public SideBarViewComponent(IReviewsService reviewsService)
 {
     this.reviewsService = reviewsService;
 }
Ejemplo n.º 32
0
 public ReviewsController(IReviewsService reviewsService)
 {
     _reviewsService = reviewsService;
 }
Ejemplo n.º 33
0
 public ReviewsVotesController(IReviewsVotesService reviewsVotesService, IReviewsService reviewsService)
 {
     this.reviewsVotesService = reviewsVotesService;
     this.reviewsService      = reviewsService;
 }