public async Task Return_Two_WhenSfHasTwoChildren()
        {
            // Arrange
            SourceFormat sf = await CreateSavedSourceFormatEntity().ConfigureAwait(false);

            DimensionStructureNode rootDsn = await CreateSavedDimensionStructureNodeEntity().ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AddRootDimensionStructureNodeAsync(sf.Id, rootDsn.Id)
            .ConfigureAwait(false);

            DimensionStructureNode child = await CreateSavedDimensionStructureNodeEntity().ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AppendDimensionStructureNodeToTreeAsync(child.Id, rootDsn.Id, sf.Id)
            .ConfigureAwait(false);

            // Act
            long amount = await _masterDataBusinessLogic
                          .MasterDataSourceFormatBusinessLogic
                          .GetAmountOfDimensionStructureNodeOfSourceFormatAsync(sf)
                          .ConfigureAwait(false);

            // Assert
            amount.Should().Be(2);
        }
Esempio n. 2
0
 public virtual void Initialize(FormatStore store, SourceFormat sourceFormat, string comment)
 {
     this.sourceFormat = sourceFormat;
     this.comment      = comment;
     this.formatStore  = store;
     this.Restart(this.formatStore.RootNode);
 }
        public async Task DeleteRootDsn_WhenItDoesNotHaveChildren()
        {
            // Arrange
            SourceFormat sourceFormat = await CreateSavedSourceFormatEntity().ConfigureAwait(false);

            DimensionStructureNode rootDsn = await CreateSavedDimensionStructureNodeEntity().ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AddRootDimensionStructureNodeAsync(sourceFormat.Id, rootDsn.Id)
            .ConfigureAwait(false);

            // Action
            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .DeleteRootDimensionStructureNodeAsync(rootDsn.Id, sourceFormat.Id)
            .ConfigureAwait(false);

            // Assert
            SourceFormat result = await _masterDataBusinessLogic.MasterDataSourceFormatBusinessLogic
                                  .GetSourceFormatByIdWithRootDimensionStructureNodeAsync(sourceFormat)
                                  .ConfigureAwait(false);

            result.SourceFormatDimensionStructureNode.Should().BeNull();

            int dsnAmount = await _masterDataBusinessLogic.MasterDataSourceFormatBusinessLogic
                            .GetAmountOfDimensionStructureNodeOfSourceFormatAsync(sourceFormat)
                            .ConfigureAwait(false);

            dsnAmount.Should().Be(0);
        }
        public async Task RootDimensionStructureNodeIsAddedToSourceFormat(Table table)
        {
            RootDimensionStructureNodeIsAddedToSourceFormatEntity instance = table
                                                                             .CreateInstance <RootDimensionStructureNodeIsAddedToSourceFormatEntity>();

            SourceFormat sf = _scenarioContext.Get <SourceFormat>(instance.SourceFormatResultKey);

            Check.IsNotNull(sf);
            DimensionStructureNode dsn = _scenarioContext.Get <DimensionStructureNode>(
                instance.DimensionStructureNodeResultKey);

            Check.IsNotNull(dsn);

            AddRootDimensionStructureNodeViewModel vm = new AddRootDimensionStructureNodeViewModel()
            {
                DimensionStructureNodeId = dsn.Id,
                SourceFormatId           = sf.Id,
            };

            DilibHttpClientResponse <SourceFormat> result = await _masterDataHttpClient.SourceFormatHttpClient
                                                            .AddRootDimensionStructureNodeAsync(vm)
                                                            .ConfigureAwait(false);

            _scenarioContext.Add(instance.ResultKey, result);
        }
Esempio n. 5
0
        public static ExportHelper GetHelper(SourceFormat srcFormat, ExportFormat format, Dictionary <string, string> customParams = null)
        {
            ExportHelper helper = null;

            switch (srcFormat)
            {
            case SourceFormat.EPUB:
                helper = new ExportHelperEpub(format);
                break;

            case SourceFormat.MHTML:
                helper = new ExportHelperMhtml(format);
                break;

            case SourceFormat.SVG:
                helper = new ExportHelperSvg(format);
                break;

            case SourceFormat.MD:
                helper = new ExportHelperMarkdown(format);
                if (customParams != null && customParams.ContainsKey("cssTheme"))
                {
                    ((ExportHelperMarkdown)helper).CssTheme = customParams["cssTheme"];
                }
                break;

            case SourceFormat.HTML:
            case SourceFormat.XHTML:
            default:
                helper = new ExportHelperHtml(format);
                break;
            }
            return(helper);
        }
Esempio n. 6
0
        public static ExportHelper GetHelper(SourceFormat srcFormat, ExportFormat format)
        {
            ExportHelper helper = null;

            switch (srcFormat)
            {
            case SourceFormat.EPUB:
                helper = new ExportHelperEpub(format);
                break;

            case SourceFormat.MHTML:
                helper = new ExportHelperMhtml(format);
                break;

            case SourceFormat.SVG:
                helper = new ExportHelperSvg(format);
                break;

            case SourceFormat.HTML:
            case SourceFormat.XHTML:
            default:
                helper = new ExportHelperHtml(format);
                break;
            }
            return(helper);
        }
        public async Task Throw_WhenBothDsnAndSfHaveConnection_ButToSomewhereElse()
        {
            // Arrange
            SourceFormat sf1 = await CreateSavedSourceFormatEntity().ConfigureAwait(false);

            DimensionStructureNode dsn1 = await CreateSavedDimensionStructureNodeEntity().ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AddRootDimensionStructureNodeAsync(sf1.Id, dsn1.Id)
            .ConfigureAwait(false);

            SourceFormat sf2 = await CreateSavedSourceFormatEntity().ConfigureAwait(false);

            DimensionStructureNode dsn2 = await CreateSavedDimensionStructureNodeEntity().ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AddRootDimensionStructureNodeAsync(sf2.Id, dsn2.Id)
            .ConfigureAwait(false);

            // Action
            Func <Task> task = async() =>
            {
                await _masterDataBusinessLogic
                .MasterDataSourceFormatBusinessLogic
                .DeleteRootDimensionStructureNodeAsync(dsn1.Id, sf2.Id)
                .ConfigureAwait(false);
            };

            // Assert
            task.Should().ThrowExactly <MasterDataBusinessLogicSourceFormatDatabaseOperationException>();
        }
        /// <inheritdoc/>
        public async Task <SourceFormat> GetSourceFormatByIdWithRootDimensionStructureNodeAsync(
            SourceFormat querySourceFormat)
        {
            try
            {
                Check.IsNotNull(querySourceFormat);
                Check.AreNotEqual(querySourceFormat.Id, 0);

                using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
                {
                    SourceFormat sourceFormat = await ctx.SourceFormats
                                                .Include(i => i.SourceFormatDimensionStructureNode)
                                                .ThenInclude(ii => ii.DimensionStructureNode)
                                                .AsNoTracking()
                                                .FirstAsync(p => p.Id == querySourceFormat.Id)
                                                .ConfigureAwait(false);

                    return(sourceFormat);
                }
            }
            catch (Exception e)
            {
                string msg = $"{nameof(MasterDataDimensionBusinessLogic)}." +
                             $"{nameof(GetSourceFormatByIdWithRootDimensionStructureNodeAsync)} operation failed. " +
                             $"For further details see inner exception.";
                throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
            }
        }
Esempio n. 9
0
        /// <inheritdoc/>
        public async Task DeleteAsync(
            SourceFormat sourceFormat,
            CancellationToken cancellationToken = default)
        {
            try
            {
                Check.IsNotNull(sourceFormat);
                await _masterDataValidators.SourceFormatValidator.ValidateAsync(sourceFormat, o =>
                {
                    o.IncludeRuleSets(SourceFormatValidatorRulesets.Delete);
                    o.ThrowOnFailures();
                }, cancellationToken).ConfigureAwait(false);

                using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
                {
                    SourceFormat result = await ctx.SourceFormats
                                          .Include(p => p.DimensionStructureNodes)
                                          .Include(pp => pp.SourceFormatDimensionStructureNode)
                                          .FirstOrDefaultAsync(
                        w => w.Id == sourceFormat.Id,
                        cancellationToken
                        )
                                          .ConfigureAwait(false);

                    if (result is null)
                    {
                        string msg = $"There is no {nameof(SourceFormat)} with id: {sourceFormat.Id}";
                        throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg);
                    }

                    if (result.DimensionStructureNodes.Any())
                    {
                        foreach (DimensionStructureNode node in result.DimensionStructureNodes)
                        {
                            ctx.Entry(node).State = EntityState.Deleted;
                        }

                        await ctx.SaveChangesAsync(cancellationToken)
                        .ConfigureAwait(false);
                    }

                    if (result.SourceFormatDimensionStructureNode is not null)
                    {
                        ctx.Entry(result.SourceFormatDimensionStructureNode).State = EntityState.Deleted;
                        await ctx.SaveChangesAsync(cancellationToken)
                        .ConfigureAwait(false);
                    }

                    ctx.Entry(result).State = EntityState.Deleted;
                    await ctx.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
                }
            }
            catch (Exception e)
            {
                string msg = $"{nameof(MasterDataSourceFormatBusinessLogic)}." +
                             $"{nameof(DeleteAsync)} operation failed! " +
                             "For further information see inner exception!";
                throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
            }
        }
        public void GivenThereIsASourceFormatDimensionStructureNodeDomainObject(Table table)
        {
            ThereIsASourceFormatDimensionStructureNodeDomainObjectEntity instance = table
               .CreateInstance<ThereIsASourceFormatDimensionStructureNodeDomainObjectEntity>();

            SourceFormatDimensionStructureNode result = new SourceFormatDimensionStructureNode();

            if (instance.SourceFormatKey != null)
            {
                SourceFormat sourceFormat = _scenarioContext[instance.SourceFormatKey]
                    as SourceFormat;
                Check.IsNotNull(sourceFormat);
                result.SourceFormatId = sourceFormat.Id;
                result.SourceFormat = sourceFormat;
            }

            if (instance.DimensionStructureNodeKey != null)
            {
                DimensionStructureNode dimensionStructureNode = _scenarioContext[instance.DimensionStructureNodeKey]
                    as DimensionStructureNode;
                Check.IsNotNull(dimensionStructureNode);
                result.DimensionStructureNodeId = dimensionStructureNode.Id;
                result.DimensionStructureNode = dimensionStructureNode;
            }

            _scenarioContext.Add(instance.ResultKey, result);
        }
        public async Task Deletes_RootDimensionStructureNodeToo()
        {
            // Arrange
            SourceFormat sourceFormatOrig = await CreateSavedSourceFormatEntity().ConfigureAwait(false);

            DimensionStructureNode dimensionStructureNode = await CreateSavedDimensionStructureNodeEntity()
                                                            .ConfigureAwait(false);

            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .AddRootDimensionStructureNodeAsync(sourceFormatOrig.Id, dimensionStructureNode.Id)
            .ConfigureAwait(false);

            // Action
            await _masterDataBusinessLogic
            .MasterDataSourceFormatBusinessLogic
            .DeleteAsync(sourceFormatOrig)
            .ConfigureAwait(false);

            // Assert
            List <SourceFormat> sourceFormats = await _masterDataBusinessLogic
                                                .MasterDataSourceFormatBusinessLogic
                                                .GetAllAsync()
                                                .ConfigureAwait(false);

            sourceFormats.Count.Should().Be(0);

            List <DimensionStructureNode> dimensionStructureNodes = await _masterDataBusinessLogic
                                                                    .MasterDataSourceFormatBusinessLogic
                                                                    .GetAllDimensionStructureNodesAsync()
                                                                    .ConfigureAwait(false);

            dimensionStructureNodes.Count.Should().Be(0);
        }
Esempio n. 12
0
        public async Task Throw_WhenInputIsInvalid(
            long id,
            string name,
            string desc,
            int isActive)
        {
            // Arrange
            SourceFormat sourceFormat = new SourceFormat
            {
                Id       = id,
                Name     = name,
                Desc     = desc,
                IsActive = isActive,
            };

            // Action
            Func <Task> task = async() =>
            {
                await _masterDataBusinessLogic
                .MasterDataSourceFormatBusinessLogic
                .AddAsync(sourceFormat)
                .ConfigureAwait(false);
            };

            // Assert
            task.Should().ThrowExactly <MasterDataBusinessLogicSourceFormatDatabaseOperationException>();
        }
Esempio n. 13
0
        /// <inheritdoc/>
        public async Task <SourceFormat> AddAsync(
            SourceFormat sourceFormat,
            CancellationToken cancellationToken = default)
        {
            using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
            {
                try
                {
                    Check.IsNotNull(sourceFormat);

                    await _masterDataValidators.SourceFormatValidator.ValidateAsync(sourceFormat, o =>
                    {
                        o.IncludeRuleSets(SourceFormatValidatorRulesets.Add);
                        o.ThrowOnFailures();
                    }, cancellationToken).ConfigureAwait(false);

                    await ctx.SourceFormats
                    .AddAsync(sourceFormat, cancellationToken)
                    .ConfigureAwait(false);

                    await ctx.SaveChangesAsync(cancellationToken)
                    .ConfigureAwait(false);

                    return(sourceFormat);
                }
                catch (Exception e)
                {
                    string msg = $"Operation failed: {nameof(AddAsync)}. " +
                                 $"For further details see inner exception.";
                    throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
                }
            }
        }
Esempio n. 14
0
 ///<Summary>
 /// ConvertHtmlToPdf to convert html file to pdf
 ///</Summary>
 public Response ConvertHtmlToPdf(string[] fileNames, string folderName)
 {
     return(ProcessTask_(fileNames, (inFiles, outPath, zipOutFolder) =>
     {
         Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();
         if (Opts.HasCustomParameter("ownerPassword") || Opts.HasCustomParameter("userPassword"))
         {
             var userPw = Opts.GetCustomParameter("userPassword");
             var ownerPw = Opts.GetCustomParameter("ownerPassword");
             if (!(string.IsNullOrEmpty(userPw) && string.IsNullOrEmpty(ownerPw)))
             {
                 pdf_options.Encryption = new Aspose.Html.Rendering.Pdf.Encryption.PdfEncryptionInfo(
                     userPw,
                     ownerPw,
                     (Aspose.Html.Rendering.Pdf.Encryption.PdfPermissions) 0xF3C,
                     Aspose.Html.Rendering.Pdf.Encryption.PdfEncryptionAlgorithm.RC4_128
                     );
             }
         }
         Dictionary <string, string> customParams = null;
         if (Opts.HasCustomParameter("mdTheme"))
         {
             var csstheme = Opts.GetCustomParameter("mdTheme");
             customParams = new Dictionary <string, string> {
                 { "cssTheme", csstheme }
             };
         }
         SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(Opts.FileName);
         ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.PDF, customParams);
         helper.Export(inFiles, outPath, pdf_options);
     }));
 }
Esempio n. 15
0
        ///<Summary>
        /// ConvertHtmlToXps to convert html file to xps
        ///</Summary>
        public Response ConvertHtmlToXps(string[] fileNames, string folderName)
        {
            return(ProcessTask_(fileNames, (inFiles, outPath, zipOutFolder) =>
            {
                Aspose.Html.Rendering.Xps.XpsRenderingOptions xps_options = new Aspose.Html.Rendering.Xps.XpsRenderingOptions();
                if (Opts.HasCustomParameter("pageSize"))
                {
                    var sz = OptionHelper.getPageSizeByName(Opts.GetCustomParameter("pageSize"));
                    if (sz != null)
                    {
                        xps_options.PageSetup.AnyPage.Size = sz;
                    }
                }
                Dictionary <string, string> customParams = null;
                if (Opts.HasCustomParameter("mdTheme"))
                {
                    var csstheme = Opts.GetCustomParameter("mdTheme");
                    customParams = new Dictionary <string, string> {
                        { "cssTheme", csstheme }
                    };
                }
                SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(Opts.FileName);
                ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.XPS, customParams);

                helper.Export(inFiles, outPath, xps_options);
            }));
        }
 /// <summary>
 /// Construct a reader from a stream
 /// </summary>
 /// <param name="stream">The stream to read from</param>
 /// <param name="format">What is the format of the file, assumes PC and similar architecture</param>
 public EndianAwareBinaryReader(Stream stream, SourceFormat format)
     : base(stream)
 {
     if ((format == SourceFormat.BigEndian && BitConverter.IsLittleEndian) ||
         (format == SourceFormat.LittleEndian && !BitConverter.IsLittleEndian))
         m_shouldReverseOrder = true;
 }
Esempio n. 17
0
        /// <inheritdoc/>
        public async Task <SourceFormat> GetByIdAsync(
            SourceFormat sourceFormat,
            CancellationToken cancellationToken = default)
        {
            Check.IsNotNull(sourceFormat);

            try
            {
                await _masterDataValidators.SourceFormatValidator.ValidateAsync(sourceFormat, o =>
                {
                    o.IncludeRuleSets(SourceFormatValidatorRulesets.GetById);
                    o.ThrowOnFailures();
                }, cancellationToken).ConfigureAwait(false);

                using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
                {
                    return(await ctx.SourceFormats
                           .FirstOrDefaultAsync(w => w.Id == sourceFormat.Id, cancellationToken)
                           .ConfigureAwait(false));
                }
            }
            catch (Exception e)
            {
                string msg = $"{nameof(MasterDataSourceFormatBusinessLogic)}." +
                             $"{nameof(GetByIdAsync)} operation failed! " +
                             $"For further information see inner exception!";
                throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
            }
        }
        public void GivenSourceFormatDimensionStructureNodeIsModified(Table table)
        {
            SourceFormatDimensionStructureNodeIsModifiedEntity instance = table
                                                                          .CreateInstance <SourceFormatDimensionStructureNodeIsModifiedEntity>();

            SourceFormatDimensionStructureNode node = _scenarioContext[instance.Key] as
                                                      SourceFormatDimensionStructureNode;

            Check.IsNotNull(node);

            if (instance.SourceFormatKey != null)
            {
                SourceFormat sourceFormat = _scenarioContext[instance.SourceFormatKey] as SourceFormat;
                Check.IsNotNull(sourceFormat);
                node.SourceFormatId = sourceFormat.Id;
            }

            if (instance.DimensionStructureNodeKey != null)
            {
                DimensionStructureNode dimensionStructureNode = _scenarioContext[instance.DimensionStructureNodeKey]
                                                                as DimensionStructureNode;
                Check.IsNotNull(dimensionStructureNode);
                node.DimensionStructureNodeId = dimensionStructureNode.Id;
            }

            _scenarioContext.Remove(instance.ResultKey);
            _scenarioContext.Add(instance.ResultKey, node);
        }
        /// <inheritdoc/>
        public async Task <SourceFormat> GetSourceFormatByIdWithAllDimensionStructuresAndNodesAsync(
            SourceFormat sourceFormat)
        {
            try
            {
                Check.IsNotNull(sourceFormat);

                using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
                {
                    SourceFormat result = await ctx.SourceFormats
                                          .AsNoTracking()
                                          .Include(i => i.DimensionStructureNodes)
                                          .ThenInclude <SourceFormat, DimensionStructureNode, DimensionStructure>(ii =>
                                                                                                                  ii.DimensionStructure)
                                          .FirstOrDefaultAsync(w => w.Id == sourceFormat.Id)
                                          .ConfigureAwait(false);

                    return(result);
                }
            }
            catch (Exception e)
            {
                string msg = $"{nameof(MasterDataSourceFormatBusinessLogic)}." +
                             $"{nameof(GetSourceFormatByIdWithAllDimensionStructuresAndNodesAsync)} " +
                             $"operation failed. For further info see inner exception.";
                throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
            }
        }
        /// <inheritdoc/>
        public async Task <SourceFormat> GetSourceFormatByIdWithActiveOnlyDimensionStructuresInTheTreeAsync(
            SourceFormat querySourceFormat)
        {
            try
            {
                Check.IsNotNull(querySourceFormat);
                SourceFormat result = await GetSourceFormatByIdWithRootDimensionStructureNodeAsync(querySourceFormat)
                                      .ConfigureAwait(false);

                if (result == null)
                {
                    return(null);
                }

                using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
                {
                    DimensionStructureNode tree = await GetActiveDimensionStructureNodeTreeAsync(
                        result.SourceFormatDimensionStructureNode.DimensionStructureNode,
                        ctx)
                                                  .ConfigureAwait(false);

                    result.SourceFormatDimensionStructureNode.DimensionStructureNode = tree;
                }

                return(result);
            }
            catch (Exception e)
            {
                string msg = $"{nameof(MasterDataSourceFormatBusinessLogic)}." +
                             $"{nameof(GetSourceFormatByIdWithActiveOnlyDimensionStructuresInTheTreeAsync)} " +
                             $"operation failed. For further info see inner exception.";
                throw new MasterDataBusinessLogicSourceFormatDatabaseOperationException(msg, e);
            }
        }
Esempio n. 21
0
        public async Task Update_SpecifiedEntity(
            string name,
            string desc,
            int isActive)
        {
            // Arrange
            SourceFormat orig       = _sourceFormatFaker.Generate();
            SourceFormat origResult = await _masterDataBusinessLogic
                                      .MasterDataSourceFormatBusinessLogic
                                      .AddAsync(orig)
                                      .ConfigureAwait(false);

            SourceFormat update = new SourceFormat
            {
                Id       = origResult.Id,
                Name     = name,
                Desc     = desc,
                IsActive = isActive,
            };

            // Action
            SourceFormat sourceFormat = await _masterDataBusinessLogic
                                        .MasterDataSourceFormatBusinessLogic
                                        .UpdateAsync(update)
                                        .ConfigureAwait(false);

            // Assert
            sourceFormat.Id.Should().Be(origResult.Id);
            sourceFormat.Name.Should().Be(update.Name);
            sourceFormat.Desc.Should().Be(update.Desc);
            sourceFormat.IsActive.Should().Be(update.IsActive);
        }
Esempio n. 22
0
 /// <inheritdoc/>
 public async Task <SourceFormat> GetSourceFormatByNameWithFullDimensionStructureTreeAsync(
     SourceFormat sourceFormat)
 {
     // try
     // {
     //     await _masterDataValidators.SourceFormatValidator.ValidateAndThrowAsync(
     //             sourceFormat,
     //             ruleSet: SourceFormatValidatorRulesets.GetByName)
     //        .ConfigureAwait(false);
     //
     //     using (MasterDataContext ctx = new MasterDataContext(_dbContextOptions))
     //     {
     //         SourceFormat result = await ctx.SourceFormats
     //            .Include(i => i.DimensionStructureTreeRoot)
     //            .FirstOrDefaultAsync(p => p.Name.Equals(sourceFormat.Name))
     //            .ConfigureAwait(false);
     //
     //         // result.DimensionStructureTreeRoot.ChildDimensionStructureTreeNodes = await GetDimensionStructureTreeAsync(
     //         //         result.DimensionStructureTreeRoot.Id,
     //         //         ctx)
     //         //    .ConfigureAwait(false);
     //
     //         return result;
     //     }
     // }
     // catch (Exception e)
     // {
     //     string message = $"The {nameof(GetSourceFormatByNameWithFullDimensionStructureTreeAsync)} " +
     //                      $"operation failed. See details in the inner exception.";
     //     throw new MasterDataBusinessLogicException(message, e);
     // }
     throw new NotImplementedException();
 }
Esempio n. 23
0
 /// <summary>
 /// Constructor with parameters
 /// </summary>
 /// <param name="file">name of the archive or file</param>
 /// <param name="format">Format of the archive or file</param>
 /// <param name="model">ViewModel for data binding</param>
 public Extractor(string file, SourceFormat format, ViewModel model)
 {
     FileName       = file;
     lastError      = "";
     DocumentFormat = format;
     embeddedFiles  = new List <ExtractorItem>();
     currentModel   = model;
 }
 /// <summary>
 /// Construct a reader from a stream
 /// </summary>
 /// <param name="stream">The stream to read from</param>
 /// <param name="format">What is the format of the file, assumes PC and similar architecture</param>
 public EndianAwareBinaryReader(Stream stream, SourceFormat format)
     : base(stream)
 {
     if ((format == SourceFormat.BigEndian && BitConverter.IsLittleEndian) ||
         (format == SourceFormat.LittleEndian && !BitConverter.IsLittleEndian))
     {
         m_shouldReverseOrder = true;
     }
 }
 ///<Summary>
 /// ConvertHtmlToXps to convert html file to xps
 ///</Summary>
 public Response ConvertHtmlToXps(string fileName, string folderName)
 {
     return(ProcessTask(fileName, folderName, ".xps", false, false, delegate(string inFilePath, string outPath, string zipOutFolder)
     {
         Aspose.Html.Rendering.Xps.XpsRenderingOptions xps_options = new Aspose.Html.Rendering.Xps.XpsRenderingOptions();
         SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(fileName);
         ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.XPS);
         helper.Export(inFilePath, outPath, xps_options);
     }));
 }
        public void ThenSourceFormatIsActivePropertyIs(string key, int expectedResult)
        {
            Check.IsNotNull(key);

            SourceFormat result = _scenarioContext[key] as SourceFormat;

            Check.IsNotNull(result);

            result.IsActive.Should().Be(expectedResult);
        }
Esempio n. 27
0
        public void GivenThereIsASourceFormatDomainObject(Table table)
        {
            GivenThereIsASourceFormatDomainObjectEntity instance = table
                                                                   .CreateInstance <GivenThereIsASourceFormatDomainObjectEntity>();

            SourceFormat sourceFormat = _masterDataTestHelper.SourceFormatFactory
                                        .Create(instance);

            _scenarioContext.Add(instance.Key, sourceFormat);
        }
Esempio n. 28
0
        /// <inheritdoc/>
        public async Task <DilibHttpClientResponse <SourceFormat> > DeleteAsync(
            SourceFormat tobeDeleted,
            CancellationToken cancellationToken = default)
        {
            string url = $"{MasterDataApi.SourceFormat.BasePath}/{MasterDataApi.SourceFormat.V1.Delete}";
            DilibHttpClientResponse <SourceFormat> result = await _diLibHttpClient
                                                            .DeleteAsync(url, tobeDeleted, cancellationToken)
                                                            .ConfigureAwait(false);

            return(result);
        }
        public void ThenSourceFormatNamePropertyIs(string key, string expectedValue)
        {
            Check.IsNotNull(key);
            Check.IsNotNull(expectedValue);

            SourceFormat result = _scenarioContext[key] as SourceFormat;

            Check.IsNotNull(result);

            result.Name.Should().Be(expectedValue);
        }
 ///<Summary>
 /// ConvertHtmlToTiff to convert html file to tiff
 ///</Summary>
 public Response ConvertHtmlToTiff(string fileName, string folderName)
 {
     return(ProcessTask(fileName, folderName, ".tiff", false, false, delegate(string inFilePath, string outPath, string zipOutFolder)
     {
         ImageRenderingOptions img_options = new ImageRenderingOptions();
         img_options.Format = ImageFormat.Tiff;
         SourceFormat srcFormat = ExportHelper.GetSourceFormatByFileName(fileName);
         ExportHelper helper = ExportHelper.GetHelper(srcFormat, ExportFormat.TIFF);
         helper.Export(inFilePath, outPath, img_options);
     }));
 }
Esempio n. 31
0
        public void GivenStoredSourceFormatDomainObjectIdValueIsSetTo(Table table)
        {
            GivenStoredSourceFormatDomainObjectIdValueIsSetTo instance = table
                                                                         .CreateInstance <GivenStoredSourceFormatDomainObjectIdValueIsSetTo>();

            SourceFormat sourceFormat = _scenarioContext[instance.Key] as SourceFormat;

            sourceFormat.Id = instance.NewValue;

            _scenarioContext.Remove(instance.ResultKey);
            _scenarioContext.Add(instance.ResultKey, sourceFormat);
        }