Пример #1
0
        public void GetPriceReturnsRightPrice()
        {
            //Arrange
            RentalPlan rPlan = new RentalPlan {
                Id = 1, Discount = 0.25, Duration = 8
            };
            EquipmentType eType = new EquipmentType {
                Id = 1, TypeName = "SkiBoots", PricePerHour = 50
            };

            ITypesRepository typesRepository = Substitute.For <ITypesRepository>();

            typesRepository.GetEquipmentTypeByEquipmentId(1).Returns(eType);

            IPlansRepository plansRepository = Substitute.For <IPlansRepository>();

            plansRepository.GetRentalPlanById(1).Returns(rPlan);

            IUnitOfWork uow = Substitute.For <IUnitOfWork>();

            uow.PlansRepository.Returns(plansRepository);
            uow.TypesRepository.Returns(typesRepository);

            PricesService pricesService = new PricesService(uow);

            //Act
            var price = pricesService.GetPrice(eType.Id, rPlan.Id);

            //Assert
            price.Should().Be(300);
        }
 public ConsumerBackgroundService(Serilog.ILogger logger, CategorysService categoryService,
                                  SpecificationsService specificationService,
                                  SpecificationsGroupService specificationGroupService,
                                  BrandsService brandsService,
                                  ProductsService productService,
                                  SKUService SKUService,
                                  SpecificationValuesService specificationValuesService,
                                  ProductSpecificationsService productSpecificationsService,
                                  SKUSpecificationsService SKUSpecificationsService,
                                  SKUFilesService SKUFilesService,
                                  InventoryService inventoryService,
                                  PricesService pricesService,
                                  MotosService motosService,
                                  FeedService feedService,
                                  OrderService ordersService)
 {
     _logger                       = logger;
     _categoryService              = categoryService;
     _specificationService         = specificationService;
     _specificationGroupService    = specificationGroupService;
     _brandsService                = brandsService;
     _productService               = productService;
     _SKUService                   = SKUService;
     _specificationValuesService   = specificationValuesService;
     _productSpecificationsService = productSpecificationsService;
     _SKUSpecificationsService     = SKUSpecificationsService;
     _SKUFilesService              = SKUFilesService;
     _inventoryService             = inventoryService;
     _pricesService                = pricesService;
     _motosService                 = motosService;
     _feedService                  = feedService;
     _ordersService                = ordersService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PricesServiceTest" /> class.
        /// </summary>
        public PricesServiceTest()
        {
            var container = Substitute.For <IEngine>();

            this.productService = Substitute.For <IProductService>();

            container.Resolve <IProductService>().Returns(this.productService);
            EngineContext.Replace(container);

            this.pricesService = new PricesService();
        }