public void ExecutionEnvironmentGetLengthOfJson_ShouldThrow() { Assert.IsNotNull(_environment); string msg = null; try { _environment.GetLength("@obj.people"); } catch (Exception e) { msg = e.Message; } Assert.AreEqual("not a recordset", msg); }
public void ExecutionEnvironmentGetLength_Should() { Assert.IsNotNull(_environment); _environment.Assign("[[rec().a]]", "sanele", 0); var recordSet = _environment.GetLength("rec"); Assert.AreEqual(1, recordSet); }
public void PushResponseIntoEnvironment_GivenEmptyMappedTo_ShouldNotAddPath() { //---------------Set up test pack------------------- const string response = "<CurrentWeather>" + "<Location><Paris></Location>" + "<Time>May 29, 2013 - 09:00 AM EDT / 2013.05.29 1300 UTC</Time>" + "</CurrentWeather>"; var environment = new ExecutionEnvironment(); var serviceOutputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("Location", "", "weather"), new ServiceOutputMapping("Time", "[[weather().Time]]", "weather") }; var serviceXml = XmlResource.Fetch("WebService"); using (var service = new WebService(serviceXml) { RequestResponse = response }) { var outPutDesc = service.GetOutputDescription(); var responseManager = new ResponseManager { OutputDescription = outPutDesc, Outputs = serviceOutputs }; var dataObjectMock = new Mock <IDSFDataObject>(); dataObjectMock.Setup(o => o.Environment).Returns(environment); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- try { responseManager.PushResponseIntoEnvironment(response, 0, dataObjectMock.Object); } catch (Exception e) { Assert.Fail(e.Message); } Assert.IsTrue(string.IsNullOrEmpty(responseManager.OutputDescription.DataSourceShapes[0].Paths[0].OutputExpression)); Assert.IsTrue(environment.HasRecordSet("[[weather()]]")); Assert.AreEqual(1, environment.GetLength("weather")); } //---------------Test Result ----------------------- }