public void GivenValidParametersForFinancialStatement_WhenRetrieveObservations2D_ExpectAvailableStatusAndValuesReturned() { COMAPIGateway gateway = new COMAPIGateway(); RetrieveObservations2DCommand command = new RetrieveObservations2DCommand(); command.AddSubject("BHP"); command.AddPublisher("JPM"); command.AddDataType("SALES"); command.AddDataType("EBIT_REP"); command.AddDataType("BROKER_NPAT"); command.AddObservedPeriod("2018"); command.AddObservedPeriod("2019"); command.AddObservedPeriod("2020"); command.Observations2DLayout = Observations2DLayoutEnum.datatypesByFinYearsAndPublishers; command.TransposeView = true; IRetrieveObservations2DResponse response = gateway.RetrieveObservations2D(command); Assert.AreEqual(RetrieveResponseStatusEnum.Available, response.Status); string[,] expected = { { "", "2018 JPM", "2019 JPM", "2020 JPM" }, { "SALES", "45809000000", "45139000000", "43952834224.06" }, { "EBIT_REP", "16169000000", "15712000000", "16594015907.75" }, { "BROKER_NPAT", "8933000000", "9466000000", "10540132135.14" } }; Assert.AreEqual(expected, response.Values); }
public void GivenInvalidSubject_WhenRetrieveObservations2D_ExpectSystemErrorStatus() { COMAPIGateway gateway = new COMAPIGateway(); RetrieveObservations2DCommand command = new RetrieveObservations2DCommand(); command.AddSubject("INVALID_SUBEJCT"); command.AddDataType("CLOSE PRICE"); command.DateRange = "01/01/2018"; IRetrieveObservations2DResponse response = gateway.RetrieveObservations2D(command); Assert.AreEqual(RetrieveResponseStatusEnum.SystemError, response.Status); }
public void GivenValidParameters_WhenRetrieveObservations2D_ExpectAvailableStatusAndValuesReturned() { COMAPIGateway gateway = new COMAPIGateway(); RetrieveObservations2DCommand command = new RetrieveObservations2DCommand(); command.AddSubject("BHP"); command.AddDataType("CLOSE PRICE"); command.DateRange = "01/01/2018"; IRetrieveObservations2DResponse response = gateway.RetrieveObservations2D(command); Assert.AreEqual(RetrieveResponseStatusEnum.Available, response.Status); string[,] expected = { { "", "CLOSE PRICE" }, { "BHP", "29.57" } }; Assert.AreEqual(expected, response.Values); }