public void ShouldThrowArgumentNullException_WhenAsycnRepositoryParameterIsNull()
        {
            IDishesAsyncRepository asyncRepository = null;
            var unitOfWorkFactory = new Mock <IDisposableUnitOfWorkFactory>();
            var usersRepository   = new Mock <IUsersAsyncRepository>();
            var dishFactory       = new Mock <IInitializedDishFactory>();
            var videoItemFactory  = new Mock <IInitializedVideoItemFactory>();
            var photoItemFactory  = new Mock <IInitializedPhotoItemFactory>();

            Assert.That(
                () => new DishesAsyncService(asyncRepository, usersRepository.Object, dishFactory.Object, videoItemFactory.Object, photoItemFactory.Object, unitOfWorkFactory.Object),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(asyncRepository)));
        }
        public DishesAsyncService(IDishesAsyncRepository dishesAsyncRepository, IUsersAsyncRepository usersAsyncRepository, IInitializedDishFactory dishFactory, IInitializedVideoItemFactory videoItemFactory, IInitializedPhotoItemFactory photoItemFactory, IDisposableUnitOfWorkFactory unitOfWorkFactory)
            : base(dishesAsyncRepository, unitOfWorkFactory)
        {
            Guard.WhenArgument(dishesAsyncRepository, nameof(IDishesAsyncRepository)).IsNull().Throw();
            Guard.WhenArgument(usersAsyncRepository, nameof(IUsersAsyncRepository)).IsNull().Throw();
            Guard.WhenArgument(dishFactory, nameof(IDishFactory)).IsNull().Throw();
            Guard.WhenArgument(videoItemFactory, nameof(IVideoItemFactory)).IsNull().Throw();
            Guard.WhenArgument(photoItemFactory, nameof(IPhotoItemFactory)).IsNull().Throw();

            this.dishesAsyncRepository = dishesAsyncRepository;
            this.usersAsyncRepository  = usersAsyncRepository;
            this.dishFactory           = dishFactory;
            this.videoItemFactory      = videoItemFactory;
            this.photoItemFactory      = photoItemFactory;
        }
예제 #3
0
        public TopDishesCachingInterceptor(IDishesAsyncRepository dishesAsyncRepository)
        {
            Guard.WhenArgument(dishesAsyncRepository, nameof(IDishesAsyncRepository)).IsNull().Throw();

            this.dishesAsyncRepository = dishesAsyncRepository;
        }