public void CheckPaymentForBook_ThenGenerate_DuplicatePackingSlip_ForRoyality() { // Arrange var product = new Product() { Name = "My Book", ProductId = "cl-001", ProducType = ProductTypes.Books, ProductPrice = 25.5F }; var order = new Order() { OrderId = "ord-0001", CreatedDateTime = DateTime.UtcNow, ProductSelected = new List <Product>() { product } }; var customer = new Customer() { CustomerId = "00111", OrderId = "ord-0001", Address = new ShippingAddress() { City = "a", CustomeAddressLine1 = "B" } }; IPackagingService _packgService = Substitute.For <IPackagingService>();; //Act var result = _packgService.GeneratePackaging(order, customer); //Assert Assert.True(result.IsSlipGenerated == true); Assert.True(result.SlipType == PackingSlipType.SlipForRoyalty); }
/// <summary> /// Creates a partial service context with only some services (for tests). /// </summary> /// <remarks> /// <para>Using a true constructor for this confuses DI containers.</para> /// </remarks> public static ServiceContext CreatePartial( IContentService contentService = null, IMediaService mediaService = null, IContentTypeService contentTypeService = null, IMediaTypeService mediaTypeService = null, IDataTypeService dataTypeService = null, IFileService fileService = null, ILocalizationService localizationService = null, IPackagingService packagingService = null, IEntityService entityService = null, IRelationService relationService = null, IMemberGroupService memberGroupService = null, IMemberTypeService memberTypeService = null, IMemberService memberService = null, IUserService userService = null, ISectionService sectionService = null, IApplicationTreeService treeService = null, ITagService tagService = null, INotificationService notificationService = null, ILocalizedTextService localizedTextService = null, IAuditService auditService = null, IDomainService domainService = null, IMacroService macroService = null, IPublicAccessService publicAccessService = null, IExternalLoginService externalLoginService = null, IServerRegistrationService serverRegistrationService = null, IRedirectUrlService redirectUrlService = null, IConsentService consentService = null) { Lazy <T> Lazy <T>(T service) => service == null ? null : new Lazy <T>(() => service); return(new ServiceContext( Lazy(publicAccessService), Lazy(domainService), Lazy(auditService), Lazy(localizedTextService), Lazy(tagService), Lazy(contentService), Lazy(userService), Lazy(memberService), Lazy(mediaService), Lazy(contentTypeService), Lazy(mediaTypeService), Lazy(dataTypeService), Lazy(fileService), Lazy(localizationService), Lazy(packagingService), Lazy(serverRegistrationService), Lazy(entityService), Lazy(relationService), Lazy(treeService), Lazy(sectionService), Lazy(macroService), Lazy(memberTypeService), Lazy(memberGroupService), Lazy(notificationService), Lazy(externalLoginService), Lazy(redirectUrlService), Lazy(consentService))); }
public SettingsViewModel( ITranslationsService translationsService, IFilePickerService filePickerService, IPackagingService packagingService, ISettingsService settingsService, IPlatformService platformService, IDialogService dialogService, IOpmlService opmlService) { Theme = string.Empty; Version = packagingService.Version; (LoadImages, NeedBanners) = (true, true); (FontSize, NotifyPeriod, MaxArticlesPerFeed) = (0, 0, 0); LeaveFeedback = new ObservableCommand(packagingService.LeaveFeedback); LeaveReview = new ObservableCommand(packagingService.LeaveReview); ImportOpml = new ObservableCommand(async() => { var stream = await filePickerService.PickFileForReadAsync(); await opmlService.ImportOpmlFeedsAsync(stream); }); ExportOpml = new ObservableCommand(async() => { var stream = await filePickerService.PickFileForWriteAsync(); await opmlService.ExportOpmlFeedsAsync(stream); }); Reset = new ObservableCommand(async() => { var response = await dialogService.ShowDialogForConfirmation( translationsService.Resolve("ResetAppNoRestore"), translationsService.Resolve("Notification")); if (response) { await platformService.ResetApp(); } }); Load = new ObservableCommand(async() => { await Task.WhenAll( StartTracking(NotifyPeriod, "NotifyPeriod", platformService.RegisterBackgroundTask), StartTracking(MaxArticlesPerFeed, "MaxArticlesPerFeed", o => Task.CompletedTask), StartTracking(NeedBanners, "NeedBanners", o => Task.CompletedTask), StartTracking(LoadImages, "LoadImages", o => Task.CompletedTask), StartTracking(FontSize, "FontSize", o => Task.CompletedTask), StartTracking(Theme, "Theme", platformService.RegisterTheme) ); }); async Task StartTracking <T>(ObservableProperty <T> property, string key, Func <T, Task> callback) where T : IConvertible { property.Value = await settingsService.GetAsync <T>(key); property.PropertyChanged += async(o, args) => { var value = property.Value; await callback.Invoke(value); await settingsService.SetAsync(key, value); }; } }
static Tracker() { _fileService = ApplicationContext.Current.Services.FileService; _contentService = ApplicationContext.Current.Services.ContentTypeService; _dataTypeService = ApplicationContext.Current.Services.DataTypeService; _packagingService = ApplicationContext.Current.Services.PackagingService; }
public void SetUp() { _managerMock = new Mock <IPackagingManager>(); _configurationMock = new Mock <IPackagingConfiguration>(); _service = new PackagingService(_managerMock.Object, _configurationMock.Object); }
public StarterKitDownloadStep(IContentService contentService, IPackagingService packageService, InstallHelper installHelper, IUmbracoContextAccessor umbracoContextAccessor) { _installHelper = installHelper; _umbracoContextAccessor = umbracoContextAccessor; _contentService = contentService; _packageService = packageService; }
public ManageController( IDishTypeService dishTypeService, IIngredientService ingredientService, IDishService dishService, IDrinkTypeService drinkTypeService, IPackagingService packagingService, IAllergenService allergenService, IWebHostEnvironment webHostEnvironment, IDrinkService drinkService, IUserService userService, IOrderService orderService, ITableService tableService, IPromoCodeService promoCodeService) { this.dishTypeService = dishTypeService; this.ingredientService = ingredientService; this.dishService = dishService; this.drinkTypeService = drinkTypeService; this.packagingService = packagingService; this.allergenService = allergenService; this.webHostEnvironment = webHostEnvironment; this.drinkService = drinkService; this.userService = userService; this.orderService = orderService; this.tableService = tableService; this.promoCodeService = promoCodeService; }
public ArticulateDataInstaller(IContentTypeService contentTypeService, IContentService contentService, IPackageInstallation packageInstallation, IPackagingService packagingService, IDataTypeService dataTypeService, ILogger logger, IMediaFileSystem mediaFileSystem) : this(contentTypeService, contentService, packageInstallation, packagingService, dataTypeService, logger, mediaFileSystem, Current.Services.LocalizationService) { }
public SolutionPackagingService(ISolutionBuilder solutionBuilder, IPrepackagingService prepackagingService, IPackagingService packagingService, IBuildFolderPathProvider buildFolderPathProvider) { if (solutionBuilder == null) { throw new ArgumentNullException("solutionBuilder"); } if (prepackagingService == null) { throw new ArgumentNullException("prepackagingService"); } if (packagingService == null) { throw new ArgumentNullException("packagingService"); } if (buildFolderPathProvider == null) { throw new ArgumentNullException("buildFolderPathProvider"); } this.solutionBuilder = solutionBuilder; this.prepackagingService = prepackagingService; this.packagingService = packagingService; this.buildFolder = buildFolderPathProvider.GetBuildFolderPath(); }
public void CheckPaymentFoVideo_LearningtoSki_AddFree_FirstAidVideo() { // Arrange var product = new Product() { Name = "Lerning To Ski", ProductId = "vid-001", ProductPrice = 28.5f, ProducType = ProductTypes.Videos, Quantity = 1 }; var order = new Order() { OrderId = "ord-0066", CreatedDateTime = DateTime.UtcNow, ProductSelected = new List <Product>() { product } }; var freeproduct = new Product() { Name = "First Aid", ProductId = "prd-001", ProductPrice = 28.5f, ProducType = ProductTypes.Videos, Quantity = 1 }; IPaymentService _pytmService = Substitute.For <IPaymentService>(); IPackagingService _pkgService = Substitute.For <IPackagingService>(); //Act var result = _pytmService.GetPaymentDetails(order); //Assert Assert.True(result.TransactionStatus == TransactionStatusConstant.TransactionStatusCompleted); var newOrder = _pkgService.AddFreeComplmentryProduct(order); var addedProduct = newOrder.ProductSelected.Find(x => x.ProductId == "prd-001"); Assert.Equal(freeproduct.ProductId, addedProduct.ProductId); }
public ChangesDeliverable( TextReader reader, TextWriter writer, IChauffeurSettings settings, IFileSystem fileSystem, IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, IMacroService macroService, IPackagingService packagingService, DatabaseSchemaHelper dbSchemaHelper, Database database ) : base(reader, writer) { _settings = settings; _fileSystem = fileSystem; _contentTypeService = contentTypeService; _dataTypeService = dataTypeService; _packagingService = packagingService; _fileService = fileService; _macroService = macroService; _dbSchemaHelper = dbSchemaHelper; _database = database; GetChangedEntityNames(); }
/// <summary> /// When the Umbraco Forms package is installed this will update the contact template and the forms picker property type /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PackagingService_ImportedPackage(IPackagingService sender, Core.Events.ImportPackageEventArgs <Core.Packaging.Models.InstallationSummary> e) { if (e != null && e.PackageMetaData != null && e.PackageMetaData.Name == "Umbraco Forms") { var formsInstallHelper = new FormsInstallationHelper(ApplicationContext.Current.Services); formsInstallHelper.UpdateUmbracoDataForFormsInstallation(); } }
public PaymentRuleEvaluator(IPaymentService paymentService, IPackagingService packService, INotificationService notfyService, IMembershipService membershipService) { _paymentService = paymentService; _packService = packService; _notfyService = notfyService; _membershipService = membershipService; _rules.Add(new GeneratePackagingSlipRule(_packService)); _rules.Add(new GenerateDuplicateSlipForRoyaltyDepartmentRule(_packService)); _rules.Add(new ActivateMembershipRule(_membershipService)); }
public MigrateToPackageData( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context) : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context) { }
public OverridingPackagingService( IPackagingService realPackagingService, IMacroService macroService, IDataTypeService dataTypeService, IContentTypeService contentTypeService) { this.realPackagingService = realPackagingService; this.macroService = macroService; this.dataTypeService = dataTypeService; this.contentTypeService = contentTypeService; }
public PackageController( IPackagingService packagingService, IBackOfficeSecurityAccessor backofficeSecurityAccessor, PackageMigrationRunner packageMigrationRunner, ILogger <PackageController> logger) { _packagingService = packagingService ?? throw new ArgumentNullException(nameof(packagingService)); _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor)); _packageMigrationRunner = packageMigrationRunner; _logger = logger; }
public ContentImportDeliverable( TextReader reader, TextWriter writer, IFileSystem fileSystem, IChauffeurSettings settings, IPackagingService packagingService) : base(reader, writer) { this.fileSystem = fileSystem; this.settings = settings; this.packagingService = packagingService; }
public SetupuSync( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context, IOptions <PackageMigrationSettings> packageMigrationsSettings) : base(packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context, packageMigrationsSettings) { }
public PackageDeliverable( TextReader reader, TextWriter writer, IFileSystem fileSystem, IChauffeurSettings settings, IPackagingService packagingService) : base(reader, writer) { this.fileSystem = fileSystem; this.settings = settings; this.packagingService = packagingService; }
public SettingViewModel( IFilePickerService filePickerService, IPackagingService packagingService, IPlatformService platformService, ISettingManager settingManager, IOpmlService opmlService) { _filePickerService = filePickerService; _packagingService = packagingService; _platformService = platformService; _settingManager = settingManager; _opmlService = opmlService; Version = _packagingService.Version; Feedback = ReactiveCommand.CreateFromTask(packagingService.LeaveFeedback); Review = ReactiveCommand.CreateFromTask(packagingService.LeaveReview); ImportSuccess = new Interaction <Unit, bool>(); ExportSuccess = new Interaction <Unit, bool>(); Import = ReactiveCommand.CreateFromTask(DoImport); Export = ReactiveCommand.CreateFromTask(DoExport); ResetConfirm = new Interaction <Unit, bool>(); Reset = ReactiveCommand.CreateFromTask(DoReset); _settingManager.Read().ToObservable() .Do(x => Banners = x.Banners) .Do(x => Images = x.Images) .Do(x => Period = x.Period) .Do(x => Theme = x.Theme) .Do(x => Read = x.Read) .Do(x => Font = x.Font) .Do(x => Max = x.Max) .Subscribe(); this.WhenAnyValue(x => x.Period).Skip(1) .SelectMany(platformService.RegisterBackgroundTask) .Subscribe(); this.WhenAnyValue(x => x.Theme).Skip(1) .SelectMany(platformService.RegisterTheme) .Subscribe(); this.WhenAnyValue( x => x.Period, x => x.Theme, x => x.Banners, x => x.Images, x => x.Read, x => x.Font, x => x.Max) .Skip(1).Select(x => new Settings { Period = x.Item1, Theme = x.Item2, Banners = x.Item3, Images = x.Item4, Read = x.Item5, Font = x.Item6, Max = x.Item7 }) .SelectMany(settingManager.Write) .Subscribe(); }
public DataTypeDeliverable( TextReader reader, TextWriter writer, IDataTypeService dataTypeService, IPackagingService packagingService, IFileSystem fileSystem, IChauffeurSettings settings) : base(reader, writer) { this.dataTypeService = dataTypeService; this.packagingService = packagingService; this.fileSystem = fileSystem; this.settings = settings; }
public ArticulateDataInstaller(IContentTypeService contentTypeService, IContentService contentService, IPackageInstallation packageInstallation, IPackagingService packagingService, IDataTypeService dataTypeService, ILogger logger, IMediaFileSystem mediaFileSystem) { _contentTypeService = contentTypeService; _contentService = contentService; _packageInstallation = packageInstallation; _packagingService = packagingService; _dataTypeService = dataTypeService; _logger = logger; _mediaFileSystem = mediaFileSystem; }
/// <summary> /// Initializes a new instance of the <see cref="PackageHelper"/> class. /// </summary> /// <param name="stream">The stream containing the package information.</param> /// <param name="packagingService">The packaging service.</param> /// <param name="fileService">The content type service.</param> public PackageHelper(Stream stream, IPackagingService packagingService, IFileService fileService) { Mandate.ParameterNotNull(stream, nameof(stream)); Mandate.ParameterNotNull(packagingService, nameof(packagingService)); Mandate.ParameterNotNull(fileService, nameof(fileService)); this.packagingService = packagingService; this.fileService = fileService; this.xml = XDocument.Load(stream); if (this.xml.Root == null || this.xml.Root.Name != Constants.Packaging.UmbPackageNodeName) { LogHelper.Error <PackageHelper>("Stream contains an invalid package file.", new ArgumentException()); } }
public BuildOutputPackagingService(IPrepackagingService prepackagingService, IPackagingService packagingService) { if (prepackagingService == null) { throw new ArgumentNullException("prepackagingService"); } if (packagingService == null) { throw new ArgumentNullException("packagingService"); } this.prepackagingService = prepackagingService; this.packagingService = packagingService; }
public ImportPackageBuilderExpression( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context) : base(context) { _packagingService = packagingService; _mediaService = mediaService; _mediaFileManager = mediaFileManager; _mediaUrlGenerators = mediaUrlGenerators; _shortStringHelper = shortStringHelper; _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider; }
public ContentTypeDeliverable( TextReader reader, TextWriter writer, IContentTypeService contentTypeService, Database database, IPackagingService packagingService, IFileSystem fileSystem, IChauffeurSettings settings ) : base(reader, writer) { this.contentTypeService = contentTypeService; this.database = database; this.packagingService = packagingService; this.fileSystem = fileSystem; this.settings = settings; }
public ProductController(IProductService productService, IVatCategoryService vatCategoryService, IVatService vatService, IUnitOfMeasureTypeService unitOfMeasureTypeService, IUnitOfMeasureService unitOfMeasureService, ISubCategoryService subCategoryService, ICategoryService categoryService, IPackagingTypeService packagingTypeService, IPackagingService packagingService, ISubBrandService subBrandService, IBrandService brandService, IOptions <AppConfig> appConfig) { _appConfig = appConfig; _productService = productService; _brandService = brandService; _subBrandService = subBrandService; _packagingService = packagingService; _packagingTypeService = packagingTypeService; _categoryService = categoryService; _subCategoryService = subCategoryService; _unitOfMeasureService = unitOfMeasureService; _unitOfMeasureTypeService = unitOfMeasureTypeService; _vatCategoryService = vatCategoryService; _vatService = vatService; }
public ContentTypeDeliverable( TextReader reader, TextWriter writer, IContentTypeService contentTypeService, IDatabaseUnitOfWorkProvider uowProvider, IPackagingService packagingService, IFileSystem fileSystem, IChauffeurSettings settings ) : base(reader, writer) { this.contentTypeService = contentTypeService; this.uowProvider = uowProvider; this.packagingService = packagingService; this.fileSystem = fileSystem; this.settings = settings; }
public ImportPackageBuilder( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context) : base(new ImportPackageBuilderExpression( packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context)) { }
public PackageMigrationBase( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context) : this( packagingService, mediaService, mediaFileManager, mediaUrlGenerators, shortStringHelper, contentTypeBaseServiceProvider, context, StaticServiceProvider.Instance.GetRequiredService <IOptions <PackageMigrationSettings> >()) { }
public PackageMigrationBase( IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context, IOptions <PackageMigrationSettings> packageMigrationsSettings) : base(context) { _packagingService = packagingService; _mediaService = mediaService; _mediaFileManager = mediaFileManager; _mediaUrlGenerators = mediaUrlGenerators; _shortStringHelper = shortStringHelper; _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider; _packageMigrationsSettings = packageMigrationsSettings; }
public ScaffoldDeliverable( TextReader reader, TextWriter writer, IChauffeurSettings settings, IFileSystem fileSystem, IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, IMacroService macroService, IPackagingService packagingService) : base(reader, writer) { this.settings = settings; this.fileSystem = fileSystem; this.contentTypeService = contentTypeService; this.dataTypeService = dataTypeService; this.packagingService = packagingService; this.fileService = fileService; this.macroService = macroService; }
public PackageInstallation(IPackagingService packagingService, IMacroService macroService, IFileService fileService, IPackageExtraction packageExtraction, string fullPathToRoot) { if (packageExtraction != null) { _packageExtraction = packageExtraction; } else { throw new ArgumentNullException("packageExtraction"); } if (macroService != null) { _macroService = macroService; } else { throw new ArgumentNullException("macroService"); } if (fileService != null) { _fileService = fileService; } else { throw new ArgumentNullException("fileService"); } if (packagingService != null) { _packagingService = packagingService; } else { throw new ArgumentNullException("packagingService"); } _fullPathToRoot = fullPathToRoot; }
public void Setup() { XDocument xml = PackageMigrationResource.GetEmbeddedPackageDataManifest(GetType()); IPackagingService packagingService = GetRequiredService <IPackagingService>(); InstallationSummary = packagingService.InstallCompiledPackageData(xml); Root = InstallationSummary.ContentInstalled.First(); ContentService.SaveAndPublish(Root); var cultures = new List <string>(); cultures.Add(GetRequiredService <ILocalizationService>().GetDefaultLanguageIsoCode()); foreach (ILanguage language in InstallationSummary.LanguagesInstalled) { cultures.Add(language.IsoCode); } Cultures = cultures.ToArray(); IHttpContextAccessor httpContextAccessor = GetRequiredService <IHttpContextAccessor>(); httpContextAccessor.HttpContext = new DefaultHttpContext { Request = { Scheme = "https", Host = new HostString("localhost"), Path = "/", QueryString = new QueryString(string.Empty) } }; //Like the request middleware we specify the VariationContext to the default language. _variationContextAccessor.VariationContext = new VariationContext(Cultures[0]); GetRequiredService <IUmbracoContextFactory>().EnsureUmbracoContext(); }
public OverridingPackagingService(PackagingService realPackagingService, IMacroService macroService) { this.realPackagingService = realPackagingService; this.macroService = macroService; }