public void GetConvertedAmount_ShouldReturnSourceNotFound()
        {
            var controller = new CurrencyConverterController();

            controller.Request = new System.Net.Http.HttpRequestMessage(HttpMethod.Get, "http://localhost:51090/CurrencyConverter?from=INR&to=USD&amount=150&source=FOO");

            var result = controller.GetConvertedAmount();

            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
        public void GetConvertedAmount_ShouldReturnBadFromCurrency()
        {
            string msg        = "Bad From Currency";
            var    controller = new CurrencyConverterController();

            controller.Request = new System.Net.Http.HttpRequestMessage(HttpMethod.Get, "http://localhost:51090/CurrencyConverter?from=foo&to=USD&amount=150&source=XE");

            var result = controller.GetConvertedAmount();

            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
            Assert.AreEqual((result as BadRequestErrorMessageResult).Message, msg);
        }
        public void GetConvertedAmount_ShouldReturnSourceNotActive()
        {
            string msg        = "Source is not Active";
            var    controller = new CurrencyConverterController();

            controller.Request = new System.Net.Http.HttpRequestMessage(HttpMethod.Get, "http://localhost:51090/CurrencyConverter?from=INR&to=USD&amount=150&source=Yahoo");

            var result  = controller.GetConvertedAmount();
            var content = result as OkNegotiatedContentResult <CroweCurrencyConversionAPI.DTOs.Response>;

            Assert.AreEqual(msg, content.Content.Error.ErrorDescription);
        }
        public void GetConvertedAmount_ShouldReturnConvertedAmount()
        {
            int convertedAmount = 200;
            var controller      = new CurrencyConverterController();

            controller.Request = new System.Net.Http.HttpRequestMessage(HttpMethod.Get, "http://localhost:51090/CurrencyConverter?from=INR&to=USD&amount=150&source=XE");

            var result = controller.GetConvertedAmount();

            var content = result as OkNegotiatedContentResult <CroweCurrencyConversionAPI.DTOs.Response>;

            Assert.AreEqual(convertedAmount, content.Content.Amount);
        }