public void GenerateCommandText_compiles_deletes()
        {
            var stateEntry = CreateStateEntry(EntityState.Deleted);

            var command = new ModificationCommand(new SchemaQualifiedName("T1"), new ParameterNameGenerator());

            command.AddStateEntry(stateEntry);

            var sqlGeneratorMock = new Mock <SqlGenerator>();
            var batch            = new ModificationCommandBatchFake();

            batch.GenerateCommandTextBase(new[] { command }, sqlGeneratorMock.Object);

            sqlGeneratorMock.Verify(g => g.AppendBatchHeader(It.IsAny <StringBuilder>()));
            sqlGeneratorMock.Verify(g => g.AppendDeleteOperation(It.IsAny <StringBuilder>(), "T1", It.IsAny <IReadOnlyList <ColumnModification> >()));
        }
        public void GenerateCommandText_compiles_deletes()
        {
            var stateEntry = CreateStateEntry(EntityState.Deleted);

            var command = new ModificationCommand("T1", null, new ParameterNameGenerator());
            command.AddStateEntry(stateEntry);

            var sqlGeneratorMock = new Mock<SqlGenerator>();
            var batch = new ModificationCommandBatchFake();
            batch.AddCommand(command, sqlGeneratorMock.Object);

            batch.GenerateCommandTextBase(sqlGeneratorMock.Object);

            sqlGeneratorMock.Verify(g => g.AppendBatchHeader(It.IsAny<StringBuilder>()));
            sqlGeneratorMock.Verify(g => g.AppendDeleteOperation(It.IsAny<StringBuilder>(), "T1", It.IsAny<IReadOnlyList<ColumnModification>>()));
        }
示例#3
0
        public void GenerateCommandText_compiles_updates()
        {
            var stateEntry = CreateStateEntry(EntityState.Modified, ValueGenerationOnSave.WhenInserting);

            var command = new ModificationCommand("T1", null, new ParameterNameGenerator());

            command.AddStateEntry(stateEntry);

            var sqlGeneratorMock = new Mock <SqlGenerator>();
            var batch            = new ModificationCommandBatchFake();

            batch.AddCommand(command, sqlGeneratorMock.Object);

            batch.GenerateCommandTextBase(sqlGeneratorMock.Object);

            sqlGeneratorMock.Verify(g => g.AppendBatchHeader(It.IsAny <StringBuilder>()));
            sqlGeneratorMock.Verify(g => g.AppendUpdateOperation(It.IsAny <StringBuilder>(), "T1", It.IsAny <IReadOnlyList <ColumnModification> >()));
        }