Exemple #1
0
        public void NotCopy_GivenNewLine()
        {
            SetUpCopierWith("\n");

            _copier.Copy();

            _destination.Letters.Should().Be(string.Empty);
        }
Exemple #2
0
        public async Task NewFileCopiedToNormalBucket(int age)
        {
            // Arrange
            // Capture the request, so we can assert on it
            s3.Setup(x => x.CopyObjectAsync(It.IsAny <CopyObjectRequest>(), stoppingToken))
            .Callback <CopyObjectRequest, CancellationToken>((req, tok) => copyRequest = req);

            // Act
            await copier.Copy(Key, age, stoppingToken);

            // Assert
            s3.Verify(x => x.CopyObjectAsync(It.IsAny <CopyObjectRequest>(), stoppingToken));
        }
 public MergeSpecification(ScriptDom.MergeSpecification src) : base(src)
 {
     this.TableAlias      = Copier.Copy <Identifier>(src.TableAlias);
     this.TableReference  = Copier.Copy <TableReference>(src.TableReference);
     this.SearchCondition = Copier.Copy <BooleanExpression>(src.SearchCondition);
     Copier.CopyList(this.ActionClauses, src.ActionClauses);
 }
 public DataModificationSpecification(ScriptDom.DataModificationSpecification src) : base(src)
 {
     this.Target           = Copier.Copy <TableReference>(src.Target);
     this.TopRowFilter     = Copier.Copy <TopRowFilter>(src.TopRowFilter);
     this.OutputIntoClause = Copier.Copy <OutputIntoClause>(src.OutputIntoClause);
     this.OutputClause     = Copier.Copy <OutputClause>(src.OutputClause);
 }
 public BooleanTernaryExpression(ScriptDom.BooleanTernaryExpression src) : base(src)
 {
     this.TernaryExpressionType = src.TernaryExpressionType;
     this.FirstExpression       = Copier.Copy <ScalarExpression>(src.FirstExpression);
     this.SecondExpression      = Copier.Copy <ScalarExpression>(src.SecondExpression);
     this.ThirdExpression       = Copier.Copy <ScalarExpression>(src.ThirdExpression);
 }
        public static void NoConversionTest()
        {
            CamelCaseDummyA camelCaseDummyA = new CamelCaseDummyA();

            camelCaseDummyA.LoadDefaults();

            CamelCaseDummyB camelCaseDummyB = new CamelCaseDummyB();

            Copier copier = new Copier();

            copier.Copy(camelCaseDummyA, camelCaseDummyB);


            Assert.Equal(camelCaseDummyA.DummyString, camelCaseDummyB.DummyString);

            Assert.Equal(camelCaseDummyA.DummyInt, camelCaseDummyB.DummyInt);

            Assert.Equal(camelCaseDummyA.DummyDouble, camelCaseDummyB.DummyDouble);

            Assert.Equal(camelCaseDummyA.DummyImage.Height, camelCaseDummyB.DummyImage.Height);
            Assert.Equal(camelCaseDummyA.DummyImage.Width, camelCaseDummyB.DummyImage.Width);
            Assert.Equal(camelCaseDummyA.DummyImage.Data, camelCaseDummyB.DummyImage.Data);

            Assert.NotEqual(camelCaseDummyA.SpecificDummyA, camelCaseDummyB.SpecificDummyB);
        }
Exemple #7
0
        bool Run()
        {
            var ci = _ignoreError ? new IgnoreErrorInteraction() : new ConsoleInteraction();

            _consoleInteraction = ci;
            Console.WriteLine(DateTime.Now);
            try
            {
                _copier = new Copier(new Uri(_sourceUri), new Uri(_destinationUri), _workingDir)
                {
                    Interaction        = ci,
                    CopyAuthor         = _copyAuthor,
                    CopyDateTime       = _copyDateTime,
                    CopySourceRevision = _copySourceRevision,
                };
                _copier.Copy(_startRevision, _endRevision);
                return(true);
            }
            catch (Exception ex)
            {
                _consoleInteraction.Error(ex.ToString());
                return(false);
            }
            finally
            {
                Console.WriteLine(DateTime.Now);
            }
        }
        public static void CamelToSnakeTest()
        {
            CamelCaseDummyA camelCaseDummyA = new CamelCaseDummyA();

            camelCaseDummyA.LoadDefaults();

            SnakeCaseDummyB snakeCaseDummyB = new SnakeCaseDummyB();

            Copier copier = new Copier();

            copier.Copy(camelCaseDummyA, snakeCaseDummyB);


            Assert.Equal(camelCaseDummyA.DummyString, snakeCaseDummyB.dummy_string);

            Assert.Equal(camelCaseDummyA.DummyInt, snakeCaseDummyB.dummy_int);

            Assert.Equal(camelCaseDummyA.DummyDouble, snakeCaseDummyB.dummy_double);

            Assert.Equal(camelCaseDummyA.DummyImage.Height, snakeCaseDummyB.dummy_image.Height);
            Assert.Equal(camelCaseDummyA.DummyImage.Width, snakeCaseDummyB.dummy_image.Width);
            Assert.Equal(camelCaseDummyA.DummyImage.Data, snakeCaseDummyB.dummy_image.Data);

            Assert.NotEqual(camelCaseDummyA.SpecificDummyA, snakeCaseDummyB.specific_dummy_b);
        }
 public SelectStatement(ScriptDom.SelectStatement src) : base(src)
 {
     this.QueryExpression = Copier.Copy <QueryExpression>(src.QueryExpression);
     this.Into            = Copier.Copy <SchemaObjectName>(src.Into);
     this.On = Copier.Copy <Identifier>(src.On);
     Copier.CopyList(this.ComputeClauses, src.ComputeClauses);
 }
 public ExecuteSpecification(ScriptDom.ExecuteSpecification src) : base(src)
 {
     this.Variable         = Copier.Copy <VariableReference>(src.Variable);
     this.LinkedServer     = Copier.Copy <Identifier>(src.LinkedServer);
     this.ExecuteContext   = Copier.Copy <ExecuteContext>(src.ExecuteContext);
     this.ExecutableEntity = Copier.Copy <ExecutableEntity>(src.ExecutableEntity);
 }
 public UnpivotedTableReference(ScriptDom.UnpivotedTableReference src) : base(src)
 {
     this.TableReference = Copier.Copy <TableReference>(src.TableReference);
     Copier.CopyList(this.InColumns, src.InColumns);
     this.PivotColumn = Copier.Copy <Identifier>(src.PivotColumn);
     this.ValueColumn = Copier.Copy <Identifier>(src.ValueColumn);
 }
 public ViewStatementBody(ScriptDom.ViewStatementBody src) : base(src)
 {
     this.SchemaObjectName = Copier.Copy <SchemaObjectName>(src.SchemaObjectName);
     Copier.CopyList(this.Columns, src.Columns);
     this.SelectStatement = Copier.Copy <SelectStatement>(src.SelectStatement);
     this.WithCheckOption = src.WithCheckOption;
 }
 public BinaryQueryExpression(ScriptDom.BinaryQueryExpression src) : base(src)
 {
     this.BinaryQueryExpressionType = src.BinaryQueryExpressionType;
     this.All = src.All;
     this.FirstQueryExpression  = Copier.Copy <QueryExpression>(src.FirstQueryExpression);
     this.SecondQueryExpression = Copier.Copy <QueryExpression>(src.SecondQueryExpression);
 }
 public WaitForStatement(ScriptDom.WaitForStatement src) : base(src)
 {
     this.WaitForOption = src.WaitForOption;
     this.Parameter     = Copier.Copy <ValueExpression>(src.Parameter);
     this.Timeout       = Copier.Copy <ScalarExpression>(src.Timeout);
     this.Statement     = Copier.Copy <WaitForSupportedStatement>(src.Statement);
 }
 public UpdateTextStatement(ScriptDom.UpdateTextStatement src) : base(src)
 {
     this.InsertOffset    = Copier.Copy <ScalarExpression>(src.InsertOffset);
     this.DeleteLength    = Copier.Copy <ScalarExpression>(src.DeleteLength);
     this.SourceColumn    = Copier.Copy <ColumnReferenceExpression>(src.SourceColumn);
     this.SourceParameter = Copier.Copy <ValueExpression>(src.SourceParameter);
 }
 public DeclareVariableElement(ScriptDom.DeclareVariableElement src) : base(src)
 {
     this.VariableName = Copier.Copy <Identifier>(src.VariableName);
     this.DataType     = Copier.Copy <DataTypeReference>(src.DataType);
     this.Nullable     = Copier.Copy <NullableConstraintDefinition>(src.Nullable);
     this.Value        = Copier.Copy <ScalarExpression>(src.Value);
 }
 public InPredicate(ScriptDom.InPredicate src) : base(src)
 {
     this.Expression = Copier.Copy <ScalarExpression>(src.Expression);
     this.Subquery   = Copier.Copy <ScalarSubquery>(src.Subquery);
     this.NotDefined = src.NotDefined;
     Copier.CopyList(this.Values, src.Values);
 }
Exemple #18
0
 public TextModificationStatement(ScriptDom.TextModificationStatement src) : base(src)
 {
     this.Bulk    = src.Bulk;
     this.Column  = Copier.Copy <ColumnReferenceExpression>(src.Column);
     this.TextId  = Copier.Copy <ValueExpression>(src.TextId);
     this.WithLog = src.WithLog;
 }
 public NamedTableReference(ScriptDom.NamedTableReference src) : base(src)
 {
     this.SchemaObject = Copier.Copy <SchemaObjectName>(src.SchemaObject);
     // Copier.CopyList(this.TableHints, src.TableHints);
     // this.TableSampleClause = Copier.Copy<TableSampleClause>(src.TableSampleClause);
     // this.TemporalClause = Copier.Copy<TemporalClause>(src.TemporalClause);
 }
Exemple #20
0
 public AssignmentSetClause(ScriptDom.AssignmentSetClause src) : base(src)
 {
     this.Variable       = Copier.Copy <VariableReference>(src.Variable);
     this.Column         = Copier.Copy <ColumnReferenceExpression>(src.Column);
     this.NewValue       = Copier.Copy <ScalarExpression>(src.NewValue);
     this.AssignmentKind = src.AssignmentKind;
 }
        public static void SnakeToCamelTest()
        {
            SnakeCaseDummyA snakeCaseDummyA = new SnakeCaseDummyA();

            snakeCaseDummyA.LoadDefaults();

            CamelCaseDummyB camelCaseDummyB = new CamelCaseDummyB();

            Copier copier = new Copier();

            copier.Copy(snakeCaseDummyA, camelCaseDummyB);


            Assert.Equal(snakeCaseDummyA.dummy_string, camelCaseDummyB.DummyString);

            Assert.Equal(snakeCaseDummyA.dummy_int, camelCaseDummyB.DummyInt);

            Assert.Equal(snakeCaseDummyA.dummy_double, camelCaseDummyB.DummyDouble);

            Assert.Equal(snakeCaseDummyA.dummy_image.Height, camelCaseDummyB.DummyImage.Height);
            Assert.Equal(snakeCaseDummyA.dummy_image.Width, camelCaseDummyB.DummyImage.Width);
            Assert.Equal(snakeCaseDummyA.dummy_image.Data, camelCaseDummyB.DummyImage.Data);

            Assert.NotEqual(snakeCaseDummyA.specific_dummy_a, camelCaseDummyB.SpecificDummyB);
        }
Exemple #22
0
        void SaveDocument(SaveType type)
        {
            if (!SBSDK.IsLicenseValid())
            {
                Alert.ShowLicenseDialog(this);
                return;
            }

            Task.Run(delegate
            {
                var input  = adapter.GetDocumentUris().ToArray();
                var output = GetOutputUri(".pdf");

                if (type == SaveType.TIFF)
                {
                    output = GetOutputUri(".tiff");
                    // Please note that some compression types are only compatible for 1-bit encoded images (binarized black & white images)!
                    var options = new TiffOptions {
                        OneBitEncoded = true, Compression = TiffCompressionOptions.CompressionCcittfax4, Dpi = 250
                    };
                    bool success = SBSDK.WriteTiff(input, output, options);
                }
                else if (type == SaveType.OCR)
                {
                    var languages = SBSDK.GetOcrConfigs().InstalledLanguages.ToArray();

                    if (languages.Length == 0)
                    {
                        RunOnUiThread(delegate
                        {
                            Alert.Toast(this, "OCR languages blobs are not available");
                        });
                        return;
                    }
                    SBSDK.PerformOCR(input, languages, output);
                }
                else
                {
                    SBSDK.CreatePDF(input, output, ScanbotSDK.Xamarin.PDFPageSize.FixedA4);
                }

                Java.IO.File file = Copier.Copy(this, output);

                var intent = new Intent(Intent.ActionView, output);

                var authority = ApplicationContext.PackageName + ".provider";
                var uri       = FileProvider.GetUriForFile(this, authority, file);

                intent.SetDataAndType(uri, MimeUtils.GetMimeByName(file.Name));
                intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
                intent.AddFlags(ActivityFlags.GrantReadUriPermission | ActivityFlags.GrantWriteUriPermission);

                RunOnUiThread(delegate
                {
                    StartActivity(Intent.CreateChooser(intent, output.LastPathSegment));
                    Alert.Toast(this, "File saved to: " + output.Path);
                });
            });
        }
 public OpenXmlTableReference(ScriptDom.OpenXmlTableReference src) : base(src)
 {
     this.Variable   = Copier.Copy <VariableReference>(src.Variable);
     this.RowPattern = Copier.Copy <ValueExpression>(src.RowPattern);
     this.Flags      = Copier.Copy <ValueExpression>(src.Flags);
     Copier.CopyList(this.SchemaDeclarationItems, src.SchemaDeclarationItems);
     this.TableName = Copier.Copy <SchemaObjectName>(src.TableName);
 }
Exemple #24
0
 public PivotedTableReference(ScriptDom.PivotedTableReference src) : base(src)
 {
     this.TableReference = Copier.Copy <TableReference>(src.TableReference);
     Copier.CopyList(this.InColumns, src.InColumns);
     this.PivotColumn = Copier.Copy <ColumnReferenceExpression>(src.PivotColumn);
     Copier.CopyList(this.ValueColumns, src.ValueColumns);
     this.AggregateFunctionIdentifier = Copier.Copy <MultiPartIdentifier>(src.AggregateFunctionIdentifier);
 }
 public RaiseErrorStatement(ScriptDom.RaiseErrorStatement src) : base(src)
 {
     this.FirstParameter  = Copier.Copy <ScalarExpression>(src.FirstParameter);
     this.SecondParameter = Copier.Copy <ScalarExpression>(src.SecondParameter);
     this.ThirdParameter  = Copier.Copy <ScalarExpression>(src.ThirdParameter);
     Copier.CopyList(this.OptionalParameters, src.OptionalParameters);
     this.RaiseErrorOptions = src.RaiseErrorOptions;
 }
Exemple #26
0
 public LikePredicate(ScriptDom.LikePredicate src) : base(src)
 {
     this.NotDefined       = src.NotDefined;
     this.OdbcEscape       = src.OdbcEscape;
     this.FirstExpression  = Copier.Copy <ScalarExpression>(src.FirstExpression);
     this.SecondExpression = Copier.Copy <ScalarExpression>(src.SecondExpression);
     this.EscapeExpression = Copier.Copy <ScalarExpression>(src.EscapeExpression);
 }
        public static object CopyToOtherClass(this object target, object source)
        {
            Copier copier = new Copier();

            copier.Copy(source, target);

            return(target);
        }
 public ReadTextStatement(ScriptDom.ReadTextStatement src) : base(src)
 {
     this.Column      = Copier.Copy <ColumnReferenceExpression>(src.Column);
     this.TextPointer = Copier.Copy <ValueExpression>(src.TextPointer);
     this.Offset      = Copier.Copy <ValueExpression>(src.Offset);
     this.Size        = Copier.Copy <ValueExpression>(src.Size);
     this.HoldLock    = src.HoldLock;
 }
 public SemanticTableReference(ScriptDom.SemanticTableReference src) : base(src)
 {
     this.SemanticFunctionType = src.SemanticFunctionType;
     this.TableName            = Copier.Copy <SchemaObjectName>(src.TableName);
     Copier.CopyList(this.Columns, src.Columns);
     this.SourceKey     = Copier.Copy <ScalarExpression>(src.SourceKey);
     this.MatchedColumn = Copier.Copy <ColumnReferenceExpression>(src.MatchedColumn);
     this.MatchedKey    = Copier.Copy <ScalarExpression>(src.MatchedKey);
 }
Exemple #30
0
 public UniqueConstraintDefinition(ScriptDom.UniqueConstraintDefinition src) : base(src)
 {
     this.Clustered    = src.Clustered;
     this.IsPrimaryKey = src.IsPrimaryKey;
     Copier.CopyList(this.Columns, src.Columns);
     this.OnFileGroupOrPartitionScheme = Copier.Copy <FileGroupOrPartitionScheme>(src.OnFileGroupOrPartitionScheme);
     this.IndexType    = Copier.Copy <IndexType>(src.IndexType);
     this.FileStreamOn = Copier.Copy <IdentifierOrValueExpression>(src.FileStreamOn);
 }