コード例 #1
0
        private static void ExecAction(object obj)
        {
            ICommand command = null;

            switch (obj)
            {
            case InitArgs args:
                var settings = new ProjectSettings(args.ProjectName, args.RootDirectory, args.IssueUrl);
                command = new InitCommand(settings);
                break;

            case AddArgs args:
                var changeLogEntry = new ChangeLogEntry(args.Description, args.Author, args.IssueId, args.Type);
                command = new AddCommand(changeLogEntry);
                break;

            case MergeArgs _:
                command = new MergeCommand();
                break;
            }

            if (command != null)
            {
                command.Execute();
            }
        }
コード例 #2
0
            public void then_merge_output_no_ids()
            {
                var entities = new List <SampleEntity>();

                for (int i = 0; i < 15; i++)
                {
                    entities.Add(new SampleEntity
                    {
                        GuidNullableProperty = null,
                        DateProperty         = DateTime.UtcNow,
                        GuidProperty         = Guid.NewGuid()
                    });
                }

                MergeCommand <SampleEntity> command = SUT.Merge <SampleEntity>(entities);

                command.Compare.IncludeProperty(x => x.Id);
                command.Output.IncludeProperty(x => x.Id);
                int changes = command.Execute(MergeType.DeleteMatched);

                //Assert
                changes.ShouldEqual(0);
                entities.ForEach(
                    (entity) => entity.Id.ShouldEqual(0));
            }
コード例 #3
0
            protected override void When()
            {
                MergeCommand <SampleEntity> command = SUT.Merge(InsertItems);

                command.Compare.IncludeProperty(x => x.Id);
                _changes = command.Execute(MergeType.Insert);
            }
コード例 #4
0
            protected override void When()
            {
                MergeCommand <SampleEntity> command = SUT.Merge(_insertedItems);

                command.Compare.IncludeProperty(x => x.Id);
                command.Output
                .SetExcludeAllByDefault(true)
                .SetExcludeDbGeneratedByDefault(ExcludeOptions.Exclude);
                _changes = command.Execute(MergeType.Insert);
            }
コード例 #5
0
            protected override void When()
            {
                using (DbContextTransaction ts = SampleDatabase.Database.BeginTransaction())
                {
                    SqlTransaction transaction = (SqlTransaction)ts.UnderlyingTransaction;

                    MergeCommand <SampleEntity> command = SUT.Merge(_insertedItems, transaction);
                    command.Compare.IncludeProperty(x => x.Id);
                    _changes = command.Execute(MergeType.Insert);
                }
            }
コード例 #6
0
            protected override void When()
            {
                using (DbContextTransaction ts = SampleDatabase.Database.BeginTransaction())
                {
                    SqlTransaction transaction = (SqlTransaction)ts.UnderlyingTransaction;

                    MergeCommand <SampleEntity> command = SUT.Merge(_insertedItems, transaction);
                    command.Compare.IncludeProperty(x => x.Id);
                    command.Output
                    .SetExcludeAllByDefault(true)
                    .SetExcludeDbGeneratedByDefault(ExcludeOptions.Exclude);
                    _changes = command.Execute(MergeType.Insert);
                }
            }
コード例 #7
0
            protected override void When()
            {
                using (var scope = new TransactionScope())
                {
                    MergeCommand <SampleEntity> command1 = SUT.Merge(InsertItems);
                    command1.UseInnerTransactionForBatches = false;
                    _changes1 = command1.Execute(MergeType.Insert);

                    MergeCommand <SampleEntity> command2 = SUT.Merge(InsertItems);
                    command2.UseInnerTransactionForBatches = false;
                    _changes2 = command2.Execute(MergeType.Insert);

                    scope.Complete();
                }
            }
コード例 #8
0
            protected override void When()
            {
                for (int i = 0; i < 15; i++)
                {
                    _insertedItems[i].DateProperty = new DateTime(2005, 2, 2, 2, 2, i);
                }

                MergeCommand <SampleEntity> command = SUT.Merge(_insertedItems);

                command.Source
                .IncludeProperty(x => x.Id)
                .IncludeProperty(x => x.DateProperty);
                command.Compare
                .IncludeProperty(x => x.Id);
                command.UpdateMatched
                .IncludeProperty(x => x.DateProperty);
                _changes = command.Execute(MergeType.Update);
            }
コード例 #9
0
            public void then_merge_inserts_multiple_entities_with_output_ids()
            {
                int insertCount = 15;
                var entities    = new List <SampleEntity>();

                for (int i = 0; i < 15; i++)
                {
                    entities.Add(new SampleEntity
                    {
                        GuidNullableProperty = null,
                        DateProperty         = DateTime.UtcNow,
                        GuidProperty         = Guid.NewGuid()
                    });
                }

                MergeCommand <SampleEntity> command = SUT.Merge <SampleEntity>(entities);
                int changes = command.Execute(MergeType.Insert);

                //Assert
                changes.ShouldEqual(insertCount);
                entities.ForEach(
                    (entity) => entity.Id.ShouldNotEqual(0));
            }
コード例 #10
0
            protected override void When()
            {
                _testName = GetType().FullName;

                _insertedItems = new List <SampleEntity>();
                for (int i = 0; i < 15; i++)
                {
                    _insertedItems.Add(new SampleEntity
                    {
                        GuidNullableProperty = null,
                        DateProperty         = new DateTime(2000, 2, 2, 2, 2, i),
                        GuidProperty         = Guid.NewGuid(),
                        StringProperty       = _testName
                    });
                }

                MergeCommand <SampleEntity> command = SUT.Merge(_insertedItems);

                command.Output.ExcludeDbGeneratedByDefault = ExcludeOptions.Exclude;

                string sql = command.ConstructCommand(MergeType.Insert, _insertedItems);

                _changes = command.Execute(MergeType.Insert);
            }
コード例 #11
0
ファイル: Branch.cs プロジェクト: yhtsnda/Bonobo-Git-Server
 /// <summary>
 /// Merge the given branch into this Branch using the given merge strategy.
 /// </summary>
 /// <param name="other"></param>
 /// <param name="strategy"></param>
 public MergeResult Merge(Branch other, MergeStrategy strategy)
 {
     return(MergeCommand.Execute(new MergeOptions {
         Branches = new[] { this, other }, MergeStrategy = strategy
     }));
 }
コード例 #12
0
ファイル: Git.cs プロジェクト: yhtsnda/Bonobo-Git-Server
 public static MergeResult Merge(MergeOptions options)
 {
     return(MergeCommand.Execute(options));
 }