コード例 #1
0
        public void CanUpdateOwnProduct()
        {
            var entityPropertyCollection = OwnProductProperties.Get();
            var properties = entityPropertyCollection.Properties.ToList();

            properties.RemoveAll(p => p.Name == "ImportCode" || p.Name == "Name");
            entityPropertyCollection.Properties = properties;
            entityPropertyCollection.PrimaryEntityColumnName   = "OwnSiteID";
            entityPropertyCollection.PrimaryEntityTableName    = "PNOwnSite";
            entityPropertyCollection.PrimaryEntityIds          = new int[] { 1, 2 };
            entityPropertyCollection.SecondaryEntityColumnName = "GlobalProductID";
            entityPropertyCollection.SecondaryEntityIds        = new int[] { 1 };
            entityPropertyCollection.SecondaryEntityTableName  = "PNGlobalProduct";
            Test(entityPropertyCollection);
            var p1 = entityPropertyCollection.Properties.First();

            p1.InitialValue = false;
            //foreach (var property in entityPropertyCollection.Properties)
            //{
            //    property.in
            //}
            var command = PriceNetSqlGenerator.GenerateUpdateCommand(entityPropertyCollection);

            ParseSql(command.CommandText);
            TestCommand(command);
        }
コード例 #2
0
        public void TableNameNull()
        {
            var entityPropertyCollection = CreateEntityPropertyCollection();

            entityPropertyCollection.TableName = null;
            var command = PriceNetSqlGenerator.GenerateInsertCommand(entityPropertyCollection);
        }
コード例 #3
0
        public void CanInsertOwnSite()
        {
            var entityPropertyCollection = OwnSiteProperties.Get();
            var command = PriceNetSqlGenerator.GenerateInsertCommand(entityPropertyCollection);

            ParseSql(command.CommandText);
            TestCommand(command);
        }
コード例 #4
0
        public void CanInsertCompetitorProduct()
        {
            var propertyCollection = CompetitorProductProperties.Get();
            var command            = PriceNetSqlGenerator.GenerateInsertCommand(propertyCollection);

            ParseSql(command.CommandText);
            TestCommand(command);
        }
コード例 #5
0
        public void CanGeneratePriceNetInsert()
        {
            var entityPropertyCollection = CreateEntityPropertyCollection();

            entityPropertyCollection.Properties = new[] { CreateNameProperty(), CreateImportCodeProperty() };
            var command = PriceNetSqlGenerator.GenerateInsertCommand(entityPropertyCollection);

            Assert.IsFalse(string.IsNullOrEmpty(command.CommandText));
        }
コード例 #6
0
        public void ValidSqlUpdateGenerated()
        {
            var entityPropertyCollection = CreateEntityPropertyCollection();

            entityPropertyCollection.Properties = new[] { CreateNameProperty(), CreateImportCodeProperty() };
            //entityPropertyCollection.PrimaryEntityColumnName = "AreaID";
            entityPropertyCollection.PrimaryEntityIds       = new[] { 1 };
            entityPropertyCollection.PrimaryEntityTableName = "Area";
            var command = PriceNetSqlGenerator.GenerateUpdateCommand(entityPropertyCollection);

            ParseSql(command.CommandText);
            TestCommand(command);
        }
コード例 #7
0
        public void ValidSqlInsertGenerated()
        {
            var entityPropertyCollection = CreateEntityPropertyCollection();

            entityPropertyCollection.Properties = new[] { CreateNameProperty(), CreateImportCodeProperty() };
            entityPropertyCollection.PrimaryEntityColumnName = null;
            entityPropertyCollection.PrimaryEntityIds        = null;
            entityPropertyCollection.PrimaryEntityTableName  = null;
            var           command = PriceNetSqlGenerator.GenerateInsertCommand(entityPropertyCollection);
            TSql100Parser parser  = new TSql100Parser(false);

            parser.Parse(new StringReader(command.CommandText), out IList <ParseError> errors);

            Assert.IsFalse(errors.Any());
        }
コード例 #8
0
        public void CanGeneratePriceNetUpdate()
        {
            var entityPropertyCollection = CreateEntityPropertyCollection();

            entityPropertyCollection.Properties = new[] { CreateNameProperty(), CreateImportCodeProperty() };
            entityPropertyCollection.PrimaryEntityColumnName = "AreaID";
            entityPropertyCollection.PrimaryEntityIds        = new[] { 1 };
            entityPropertyCollection.PrimaryEntityTableName  = "PNArea";
            Test(entityPropertyCollection);
            var p = entityPropertyCollection.Properties.First();

            p.Value = "Amended";
            var command = PriceNetSqlGenerator.GenerateUpdateCommand(entityPropertyCollection);

            Assert.IsFalse(string.IsNullOrEmpty(command.CommandText));
        }
コード例 #9
0
        public void CanUpdateArea()
        {
            var entityPropertyCollection = AreaProperties.Get();
            var properties = entityPropertyCollection.Properties.ToList();

            properties.RemoveAll(p => p.Name == "ImportCode" || p.Name == "Name");
            entityPropertyCollection.Properties = properties;
            //entityPropertyCollection.PrimaryEntityColumnName = "AreaID";
            entityPropertyCollection.PrimaryEntityTableName = "Area";
            entityPropertyCollection.PrimaryEntityIds       = new int[] { 1, 2 };
            Test(entityPropertyCollection);
            entityPropertyCollection.Properties.First().Value = "Amended";
            var command = PriceNetSqlGenerator.GenerateUpdateCommand(entityPropertyCollection);

            ParseSql(command.CommandText);
            TestCommand(command);
        }