Exemple #1
0
        public void TestQueryWithError()
        {
            IptDataModel client = new IptDataModelClient();
            QueryRequest qRequest = new QueryRequest();

            // Header
            SIFHeaderType header = createHeader();
            header.TopicName = "FoodserviceMilkSales";
            header.MaxBufferSize = uint.MaxValue;
            header.MaxBufferSizeSpecified = true;
            header.ResponseVersion = new String[] { "1.1", "2.0r1", "2.1", "2.5", "2.*" };
            qRequest.SIFHeader = header;

            // Query
            QueryTypeQueryObject query = new QueryTypeQueryObject();
            query.ObjectName = "FoodserviceMilkSales";
            QueryType type = new QueryType();
            type.QueryObject = query;
            qRequest.Query = type;

            bool exceptionThrown = false;

            try
            {
                EventStatus evStatus = client.Query(qRequest);
            }
            catch (FaultException<DataModelErrorType> ex)
            {
                exceptionThrown = true;
                Assert.AreEqual(ex.Detail.Category, InfrastructureErrorCategoryType.Item8, "Expected Category of 8");
                Assert.AreEqual(ex.Detail.Code, "4", "Expected Code of 4");
            }
            catch (Exception ex)
            {
                Assert.Fail("Unable to parse SOAP Fault into expected exception type: " + ex.ToString());
            }

            Assert.IsTrue(exceptionThrown, "A SOAP Fault was not returned");
        }
Exemple #2
0
        public void TestQuery()
        {
            IptDataModel client = new IptDataModelClient();
            QueryRequest qRequest = new QueryRequest();

            // Header
            SIFHeaderType header = createHeader();
            header.TopicName = "SchoolCourseInfo";
            header.MaxBufferSize = uint.MaxValue;
            header.MaxBufferSizeSpecified = true;
            header.ResponseVersion = new String[] { "1.1", "2.0r1", "2.1", "2.5", "2.*" };
            qRequest.SIFHeader = header;

            // Query
            QueryTypeQueryObject query = new QueryTypeQueryObject();
            query.ObjectName = "SchoolCourseInfo";
            QueryType type = new QueryType();
            type.QueryObject = query;

            qRequest.Query = type;

            EventStatus evStatus = client.Query(qRequest);
            runAssertions(evStatus.SIFHeader);
            Assert.IsNotNull(evStatus.Status, "Status is null");
            StatusType status = evStatus.Status;
            Console.WriteLine("Invoked with return code " + status.Code);

            Assert.AreEqual(status.Code, InfrastructureStatusCodeType.Item0);
            Assert.AreEqual(status.Desc, "Success");
        }