コード例 #1
0
        public void EmptyObjectNameTest()
        {
            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings
            {
                Encoding = Encoding.GetEncoding("UTF-8")
            };

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            SelectBuilder builder = new SelectBuilder();

            ISelect[] fields = builder.Field("CUSTOMERID").GetFields();

            IQueryFunction query = new QueryFunction("unittest")
            {
                FromObject   = "",
                SelectFields = fields
            };

            var ex = Record.Exception(() => query.WriteXml(ref xml));

            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("From Object is required for query; set through method from setter.", ex.Message);
        }
コード例 #2
0
        public void NoSelectFieldsTest()
        {
            Stream            stream      = new MemoryStream();
            XmlWriterSettings xmlSettings = new XmlWriterSettings
            {
                Encoding = Encoding.GetEncoding("UTF-8")
            };

            IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);

            IQueryFunction query = new QueryFunction("unittest")
            {
                FromObject = "CUSTOMER"
            };

            var ex = Record.Exception(() => query.WriteXml(ref xml));

            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("Select fields are required for query; set through method SelectFields setter.", ex.Message);
        }