Example #1
0
        public async Task BuyOfferForUser_WithInValidData_ShouldNotBuyOffer()
        {
            var expected = 1;
            var guid1    = Guid.NewGuid().ToString();
            var guid2    = Guid.NewGuid().ToString();

            var moqHttpContextAccessor = new Mock <IHttpContextAccessor>();

            var moqCategoriesService = new Mock <ICategoryService>();
            var moqCloudinaryService = new Mock <ICloudinaryService>();
            var moqEmailSender       = new Mock <IEmailSender>();

            var context = InitializeContext.CreateContextForInMemory();

            var user1 = new ApplicationUser()
            {
                Id       = guid1,
                UserName = "******",
            };

            var user2 = new ApplicationUser()
            {
                Id       = guid2,
                UserName = "******",
            };

            var createOfferInputModel = new CreateOfferModel()
            {
                Name         = "Wow Account",
                CategotyName = "Wow",
                CreatorId    = guid1,
                Description  = "Some Test Description",
                Price        = 10.00,
                PicUrl       = "link",
            };

            this.offerService = new OfferService(context, moqCategoriesService.Object, moqCloudinaryService.Object);
            this.orderService = new OrderService(context, this.offerService, moqEmailSender.Object);

            var offer = await this.offerService.CreateOfferAsync(createOfferInputModel);

            await this.offerService.ApproveOfferAsync(offer.Id);

            context.Users.Add(user1);
            context.Users.Add(user2);
            await context.SaveChangesAsync();

            // Assert
            await this.orderService.BuyOfferForUser("InvalidID", guid2, new BuyInput()
            {
                Email     = "*****@*****.**",
                FirstName = "TestFirstName",
                LastName  = "TestLastName",
                OfferId   = offer.Id,
            });

            var offerBought = await context.Orders.FirstOrDefaultAsync(x => x.OfferId == offer.Id && x.UserId == guid2);

            Assert.Null(offerBought);
        }
 public CustomerController(IUserService user, IOfferService offer, ISessionService sessService, IMatchService match)
 {
     _user    = user;
     _offer   = offer;
     _session = sessService;
     _match   = match;
 }
Example #3
0
 public BillController(IBillService billService, IUsersService usersService, IVoucherService voucherService, IOfferService offerService)
 {
     this.billService    = billService;
     this.usersService   = usersService;
     this.voucherService = voucherService;
     this.offerService   = offerService;
 }
Example #4
0
        public MyOffersModel(IOfferService offerService, IMapper mapper)
        {
            this.offerService = offerService;
            this.mapper       = mapper;

            Title = "My offers";
        }
Example #5
0
        public EditOfferModel(IOfferService offerService, IMapper mapper)
        {
            this.offerService = offerService;
            this.mapper       = mapper;

            Title = "Edit offer";
        }
Example #6
0
 public HomeController(IItemService itemService, IOfferService offerService, IShoppingCartService shoppingCartService, IShoppingCartItemService shoppingCartItemService)
 {
     _itemService             = itemService;
     _offerService            = offerService;
     _shoppingCartService     = shoppingCartService;
     _shoppingCartItemService = shoppingCartItemService;
 }
Example #7
0
 public UserController(IUserService proxy, IOfferService offerService, IOrderService orderProxy, IAuthenticationManager authentication)
 {
     this._proxy        = proxy;
     this._offerProxy   = offerService;
     this._orderProxy   = orderProxy;
     this._authnManager = authentication;
 }
Example #8
0
        public OfferManager(
            ISteamHubConnections steamHubConnections,
            IOfferService offerService,
            RpcSteamListener steamListener,
            ILogServiceFactory logger,
            IGrpcServiceFactory factory,
            IUserService userService,
            IRepoServiceFactory repoServiceFactory
            )
        {
            _rakeItemRepoService = repoServiceFactory.RakeItemRepoService;
            _steamServiceClient  = factory.GetSteamServiceClient(new SteamInventoryCacheManager());
            _steamHubConnections = steamHubConnections;
            _offerService        = offerService;
            _userService         = userService;
            _logger = logger.CreateLogger <OfferManager>();

            steamListener.OnOfferStatusChanged += async(sender, offer) =>
            {
                _logger.Info($"Received statuscode {offer.StatusCode}");

                try
                {
                    await HandleOffer(offer);
                }
                catch (System.Exception e)
                {
                    _logger.Error(offer.SteamId, null, e, new Dictionary <string, object>
                    {
                        { "Offer", offer }
                    });
                }
            };
        }
Example #9
0
 public CategoryController(IUnitOfWork db, ICategoryService categoryService, IBillService billService, IOfferService offerService)
 {
     this.db = db;
     this.categoryService = categoryService;
     this.billService     = billService;
     this.offerService    = offerService;
 }
Example #10
0
 public AddOfferCommand(IOfferService offerService, IMapper mapper, INotifier notifier, IHubManager <NotifierHub> hubManager)
 {
     this.offerService = offerService;
     this.mapper       = mapper;
     this.notifier     = notifier;
     this.hubManager   = hubManager;
 }
 public NotificationsController(INotificationService notificationService, IUserService userService, IOfferService offerService, IRentService rentService)
 {
     _notificationService = notificationService;
     _userService         = userService;
     _offerService        = offerService;
     _rentService         = rentService;
 }
Example #12
0
 public CommonController(
     IUtilityService utilityService,
     ICampaignService campaignService,
     ICartService cartService,
     IOfferService offerService,
     IAccountService accountService,
     IShippingService shippingService,
     IProductService productService,
     IPriceFormatter priceFormatter,
     IWorkContext workContext,
     ICacheManager cacheManager,
     HttpContextBase httpContext,
     EmailSettings emailSettings,
     StoreInformationSettings storeInformationSettings)
 {
     _utilityService           = utilityService;
     _campaignService          = campaignService;
     _cartService              = cartService;
     _offerService             = offerService;
     _accountService           = accountService;
     _shippingService          = shippingService;
     _productService           = productService;
     _priceFormatter           = priceFormatter;
     _workContext              = workContext;
     _cacheManager             = cacheManager;
     _httpContext              = httpContext;
     _emailSettings            = emailSettings;
     _storeInformationSettings = storeInformationSettings;
 }
Example #13
0
        public CreateOfferModel(IOfferService offerService, IMapper mapper)
        {
            this.offerService = offerService;
            this.mapper       = mapper;

            Title = "Create offer";
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            offerService = CompositionRootHelper.GetCompositionRoot(Context).OfferService;
            emcArticles.Initialize(OffersProvider, this);
        }
Example #15
0
 public OfferController(IOfferService offerService, ICustomerService customerService, IProductService productService, IOfferItemService offerItemService)
 {
     this.offerService     = offerService;
     this.productService   = productService;
     this.customerService  = customerService;
     this.offerItemService = offerItemService;
 }
 public OfferApiService(IUnitOfWork uow, IOfferService offerService, IMapper mapper, ITenantService tenantService)
 {
     _uow           = uow;
     _offerService  = offerService;
     _mapper        = mapper;
     _tenantService = tenantService;
 }
 public OfferController(
     UserManager <ApplicationUser> userManager,
     IOfferService offerService)
 {
     _offerService = offerService;
     _userManager  = userManager;
 }
Example #18
0
 public ProductController(
     IBrandService brandService,
     IProductService productService,
     IOfferService offerService,
     ISearchService searchService,
     ICategoryService categoryService,
     IShippingService shippingService,
     ICartService cartService,
     IUtilityService utilityService,
     IPriceFormatter priceFormatter,
     IRecentlyViewedProductsService recentlyViewedProductsService,
     IWorkContext workContext,
     CatalogSettings catalogSettings)
 {
     _brandService    = brandService;
     _productService  = productService;
     _offerService    = offerService;
     _searchService   = searchService;
     _categoryService = categoryService;
     _shippingService = shippingService;
     _cartService     = cartService;
     _utilityService  = utilityService;
     _priceFormatter  = priceFormatter;
     _recentlyViewedProductsService = recentlyViewedProductsService;
     _catalogSettings = catalogSettings;
     _workContext     = workContext;
 }
 public OfferController(IUnitOfWork db, IOfferService offerService, IUserService userService, ICategoryService categoryService)
 {
     this.db              = db;
     this.offerService    = offerService;
     this.userService     = userService;
     this.categoryService = categoryService;
 }
Example #20
0
        public Statistics()
        {
            InitializeComponent();
            _offerproxy = new OfferServiceClient("OfferServiceTcpEndpoint");

            DataContext = new AllServices();
        }
Example #21
0
 public VoucherController(IUnitOfWork db, IVoucherService voucherService, IOfferService offerService, IUserService userService)
 {
     this.db             = db;
     this.voucherService = voucherService;
     this.offerService   = offerService;
     this.userService    = userService;
 }
Example #22
0
 public ShoppingCartController(
     IAccountService accountService,
     ICartService cartService,
     IProductService productService,
     IShippingService shippingService,
     IUtilityService utilityService,
     IOfferService offerService,
     IWorkContext workContext,
     IPriceFormatter priceFormatter,
     ICacheManager cacheManager,
     TaxSettings taxSettings,
     ApolloSessionState session)
 {
     _accountService  = accountService;
     _cartService     = cartService;
     _productService  = productService;
     _shippingService = shippingService;
     _utilityService  = utilityService;
     _offerService    = offerService;
     _workContext     = workContext;
     _priceFormatter  = priceFormatter;
     _cacheManager    = cacheManager;
     _taxSettings     = taxSettings;
     _session         = session;
 }
Example #23
0
 public CustomerController(ICustomerProfileService customerService, IJobService jobService, IOfferService offerService, ICommitProvider commitProvider)
 {
     _customerService = customerService;
     _jobService      = jobService;
     _offerService    = offerService;
     _commitProvider  = commitProvider;
 }
        public async Task GetAdminOffersForApprove_WithValidData_ShouldReturnAdminOffers()
        {
            var expected  = 1;
            var guid      = Guid.NewGuid().ToString();
            var guid2     = Guid.NewGuid().ToString();
            var guidOffer = Guid.NewGuid().ToString();

            var moqHttpContextAccessor = new Mock <IHttpContextAccessor>();

            var moqCategoriesService = new Mock <ICategoryService>();
            var moqCloudinaryService = new Mock <ICloudinaryService>();
            var moqIFormFile         = new Mock <IFormFile>();

            var context = InitializeContext.CreateContextForInMemory();

            this.userService = new UserService(context, moqHttpContextAccessor.Object);

            var user1 = new ApplicationUser()
            {
                Id              = guid,
                UserName        = "******",
                ProfilePhotoUrl = "TestUrl.com",
            };

            var createOfferInputModel = new CreateOfferModel()
            {
                Name         = "Wow Account",
                CategotyName = "Wow",
                CreatorId    = guid,
                Description  = "Some Test Description",
                Price        = 10.00,
                PicUrl       = "link",
            };

            var createOfferInputModelApproved = new CreateOfferModel()
            {
                Name         = "Wow Account",
                CategotyName = "Wow",
                CreatorId    = guid,
                Description  = "Some Test Description",
                Price        = 10.00,
                PicUrl       = "link",
            };

            this.offerService = new OfferService(context, moqCategoriesService.Object, moqCloudinaryService.Object);

            var offer = await this.offerService.CreateOfferAsync(createOfferInputModel);

            var offerapproved = await this.offerService.CreateOfferAsync(createOfferInputModelApproved);

            await this.offerService.ApproveOfferAsync(offerapproved.Id);

            context.Users.Add(user1);
            await context.SaveChangesAsync();

            // Assert
            var userGet = await this.userService.GetAdminOffersForApproveCount();

            Assert.Equal(expected, userGet);
        }
Example #25
0
 public CheckoutService(IItemService itemService, IOfferService offerService,
                        ILoggingService loggingService)
 {
     _itemService    = itemService;
     _offerService   = offerService;
     _loggingService = loggingService;
 }
Example #26
0
 public DialogController(IMessageService messageService, IOfferService offerService, IUserProfileService userProfileService, IDialogService dialogService)
 {
     _messageService     = messageService;
     _offerService       = offerService;
     _userProfileService = userProfileService;
     _dialogService      = dialogService;
 }
        public async Task GetMessagesForOfferAsync_WithValidData_ShouldReturnMessages()
        {
            var expected = 2;
            var guid1    = Guid.NewGuid().ToString();
            var guid2    = Guid.NewGuid().ToString();

            var moqHttpContextAccessor = new Mock <IHttpContextAccessor>();

            var moqCategoriesService = new Mock <ICategoryService>();
            var moqCloudinaryService = new Mock <ICloudinaryService>();
            var moqOfferService      = new Mock <IOfferService>();

            var context = InitializeContext.CreateContextForInMemory();

            this.userService     = new UserService(context, moqHttpContextAccessor.Object);
            this.messagesService = new MessagesService(context, this.userService, moqOfferService.Object);

            var sender = new ApplicationUser()
            {
                Id       = guid1,
                UserName = "******",
            };

            var reciver = new ApplicationUser()
            {
                Id       = guid2,
                UserName = "******",
            };

            var createOfferInputModel = new CreateOfferModel()
            {
                Name         = "Wow Account",
                CategotyName = "Wow",
                CreatorId    = guid2,
                Description  = "Some Test Description",
                Price        = 10.00,
                PicUrl       = "link",
            };

            this.offerService = new OfferService(context, moqCategoriesService.Object, moqCloudinaryService.Object);

            var offer = await this.offerService.CreateOfferAsync(createOfferInputModel);

            await this.offerService.ApproveOfferAsync(offer.Id);

            context.Users.Add(sender);
            context.Users.Add(reciver);
            await context.SaveChangesAsync();

            // Assert

            await this.messagesService.CreateMessageAsync(guid1, guid2, offer.Id, "TestMessage");

            await this.messagesService.CreateMessageAsync(guid1, guid2, offer.Id, "TestMessage2");

            var unreadMessages = await this.messagesService.GetMessagesForOfferAsync(offer.Id, guid1, guid2);

            Assert.Equal(expected, unreadMessages.Count);
        }
Example #28
0
 public MessageController(IMessageService messageService, IOfferService offerService, IUserProfileService userProfileService, IDialogService dialogService, IMessageHub messageHub)
 {
     this.messageHub         = messageHub;
     this.messageService     = messageService;
     this.offerService       = offerService;
     this.userProfileService = userProfileService;
     this.dialogService      = dialogService;
 }
Example #29
0
 public ProfileController(IMapper mapper,
                          IOfferService offerService,
                          ICustomerService customerService)
 {
     _offerService    = offerService ?? throw new ArgumentNullException(nameof(offerService));
     _customerService = customerService ?? throw new ArgumentNullException(nameof(offerService));
     _mapper          = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Example #30
0
 public BuyNowModel(IOfferService offerService,
                    ITransactionService transactionService,
                    UserManager <AppUser> userManager)
 {
     _userManager        = userManager;
     _offerService       = offerService;
     _transactionService = transactionService;
 }
Example #31
0
 public OffersProvider(IOfferService offerService)
 {
     if (offerService == null)
     {
         throw new ArgumentNullException("offerService");
     }
     this.offerService = offerService;
 }
Example #32
0
 public FeedbackController(IOfferService offerService, IFeedbackService feedbackService, IUserProfileService userProfileService, IOrderService orderService, IOrderStatusService orderStatusService)
 {
     _orderStatusService = orderStatusService;
     _offerService       = offerService;
     _feedbackService    = feedbackService;
     _userProfileService = userProfileService;
     _orderService       = orderService;
 }
 public MortgageApplicationProcessor(
     ILocationProvider locationProvider,
     ITimeProvider timeProvider,
     IOfferService offerService)
 {
     this.locationProvider = locationProvider;
     this.timeProvider = timeProvider;
     this.offerService = offerService;
 }
Example #34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            offerService = CompositionRootHelper.GetCompositionRoot(Context).OfferService;
            categoryRepository = CompositionRootHelper.GetCompositionRoot(Context).CategoryRepository;

            if (!IsPostBack)
            {
                int offerId;
                if (int.TryParse(Request["offerId"], out offerId))
                {
                    var offer = offerService.Repository.Read(offerId);
                    BindControls(offer);
                }
            }
        }
Example #35
0
 protected void Page_Load(object sender, EventArgs e)
 {
     offerService = CompositionRootHelper.GetCompositionRoot(Context).OfferService;
     offerTypeRepository = CompositionRootHelper.GetCompositionRoot(Context).OfferTypeRepository;
     if (!IsPostBack)
     {
         if (SaveOfferType(Request.Params["offerType"]))
         {
             rptOffersList.DataSource = offerService.GetOffers(OfferType);
         }
         else
         {
             rptOffersList.DataSource = offerService.GetOffers();
         }
     }
 }
 public OfferController(IOfferService offerService)
 {
     _offerService = offerService;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            offerService = CompositionRootHelper.GetCompositionRoot(Context).OfferService;

            if (!IsPostBack)
            {
                afuImageUpload.OnClientUploadComplete = GetUploadCompleteCallbackName();

                ddlOfferType.DataSource = offerService.GetOfferTypes();
                ddlOfferType.DataValueField = "Id";
                ddlOfferType.DataTextField = "Name";

                ddlOfferType.DataBind();

                CurrentOfferId = PageHelper.GetIdInSpecialWay(Page.Request[OfferIdKey]);
                if (CurrentOfferId != 0)
                {
                    BindOfferControlsSafe(CurrentOfferId);
                }
            }
        }
Example #38
0
 public HomeController(IWeChatUserService weChatUserService, IOfferService offerService, ICountryCodeService countryCodeService)
 {
     _weChatUserService = weChatUserService;
     _offerService = offerService;
     _countryCodeService = countryCodeService;
 }
Example #39
0
 public OrdersController()
 {
     _orderService = IoC.Instance.Resolve<IOrderService>();
     _offerService = IoC.Instance.Resolve<IOfferService>();
     _allOrders = new Dictionary<int, Order>();
 }
 public DefaultController(IPropertyService propertyService, IOfferService offerService)
 {
     _propertyService = propertyService;
     _offerService = offerService;
 }
Example #41
0
 private void InjectServices(HttpContext context)
 {
     var root = CompositionRootHelper.GetCompositionRoot(context);
     offerService = root.OfferService;
 }