Exemplo n.º 1
0
        public void TestMethod3()
        {
            // Arrange
            var sequence = PipeConnector.CreateSequence <AirportInfoComponent, UnaryAbbreviationExtenderComponent>();

            // Act
            var example = sequence.Execute("JFK");

            // Assert
            Assert.True(example.ToString().Contains("John Fitzgerald Kennedy"));
        }
Exemplo n.º 2
0
        public void TestMethod4()
        {
            // Arrange
            var sequence = PipeConnector.CreateSequence <AirportInfoComponent, UnaryAbbreviationExtenderComponent>();
            var inverse  = PipeConnector.CreateSequence <UnaryAbbreviationExtenderComponent, AirportInfoComponent>();

            // Act
            var example        = sequence.Execute("JFK") as List <object>;
            var inverseExample = inverse.Execute("JFK") as List <object>;

            // Assert
            Assert.NotNull(example);
            Assert.NotNull(inverseExample);

            Assert.True(example[0].ToString().Contains("John Fitzgerald Kennedy"));
            Assert.AreEqual("The computation finished with an error.", inverseExample[0]);
        }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            // receive raw airport data
            var info = AirportInfoComponent.Execute("JFK");
            // {"delay":"true","IATA":"JFK"...

            // directly map results to your classes
            var delay = AirportInfoComponent.Execute <AirportInfo>("JFK").Delay;
            // true

            // string components together
            var sequence = PipeConnector.CreateSequence <AirportInfoComponent, UnaryAbbreviationExtenderComponent>();
            var example  = sequence.Execute("JFK");
            // example = {"delay":"true","internationalAirTransportAssociation":"John Fitzgerald Kennedy...

            var username  = "******";
            var password  = "******";
            var sessionId = GeoNamesPostalCodesComponent.Login(username, password);
            var result    = (string)GeoNamesPostalCodesComponent.PostalCode(username, sessionId, "8001");

            var geo = result.ToInstance <GeoInfo>();
        }