예제 #1
0
        public void CreateDeleteOperation_should_return_valid_history_operation()
        {
            var modelBuilder = new DbModelBuilder();
            var model        = modelBuilder.Build(ProviderInfo);
            var edmxString   = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(
                       edmxString, new XmlWriterSettings
            {
                Indent = true
            }))
            {
                EdmxWriter.WriteEdmx(model, xmlWriter);
            }

            var historyRepository = new HistoryRepository(Mock.Of <InternalContextForMock>(), ConnectionString, ProviderFactory, "MyKey", null, HistoryContext.DefaultFactory);

            var historyOperation
                = (HistoryOperation)historyRepository.CreateDeleteOperation("Migration1");

            Assert.NotEmpty(historyOperation.CommandTrees);
            Assert.Equal(DbCommandTreeKind.Delete, historyOperation.CommandTrees.Single().CommandTreeKind);
        }
예제 #2
0
        public void CreateDeleteOperation_should_return_valid_history_operation()
        {
            var modelBuilder = new DbModelBuilder();
            var model        = modelBuilder.Build(ProviderInfo);
            var edmxString   = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(
                       edmxString, new XmlWriterSettings
            {
                Indent = true
            }))
            {
                EdmxWriter.WriteEdmx(model, xmlWriter);
            }

            var historyRepository = new HistoryRepository(ConnectionString, ProviderFactory, "MyKey");

            var historyOperation
                = (HistoryOperation)historyRepository.CreateDeleteOperation("Migration1");

            Assert.NotEmpty(historyOperation.Commands);
            Assert.Equal(2, historyOperation.Commands.Single().Parameters.Count());
        }
        public void CreateDeleteOperation_should_return_valid_history_operation()
        {
            var modelBuilder = new DbModelBuilder();
            var model = modelBuilder.Build(ProviderInfo);
            var edmxString = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(
                edmxString, new XmlWriterSettings
                                {
                                    Indent = true
                                }))
            {
                EdmxWriter.WriteEdmx(model, xmlWriter);
            }

            var historyRepository = new HistoryRepository(ConnectionString, ProviderFactory, "MyKey", null);

            var historyOperation
                = (HistoryOperation)historyRepository.CreateDeleteOperation("Migration1");

            Assert.NotEmpty(historyOperation.Commands);
            Assert.Equal(2, historyOperation.Commands.Single().Parameters.Count);
        }
예제 #4
0
        public void CreateDeleteOperation_should_return_valid_history_operation()
        {
            var modelBuilder = new DbModelBuilder();
            var model = modelBuilder.Build(ProviderInfo);
            var edmxString = new StringBuilder();

            using (var xmlWriter = XmlWriter.Create(
                edmxString, new XmlWriterSettings
                                {
                                    Indent = true
                                }))
            {
                EdmxWriter.WriteEdmx(model, xmlWriter);
            }

            var historyRepository = new HistoryRepository(Mock.Of<InternalContextForMock>(), ConnectionString, ProviderFactory, "MyKey", null, HistoryContext.DefaultFactory);

            var historyOperation
                = (HistoryOperation)historyRepository.CreateDeleteOperation("Migration1");

            Assert.NotEmpty(historyOperation.CommandTrees);
            Assert.Equal(DbCommandTreeKind.Delete, historyOperation.CommandTrees.Single().CommandTreeKind);
        }