Exemple #1
0
        public void GetCurrencyTextValue_InvalidParameter_name()
        {
            // arrange
            string testValue    = "123.45";
            string expectedName = "";
            var    controller   = new CurrencyToTextController();

            // act
            IHttpActionResult result = controller.GetCurrencyTextValue(expectedName, testValue) as OkNegotiatedContentResult <CurrencyText>;

            // Assert
            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
        }
Exemple #2
0
        public void GetCurrencyTextValue_LargeInput_ShouldReturnCorrectResult()
        {
            // arrange
            string testValue      = "1911655499123.99";
            string expectedOutput = "ONE TRILLION, NINE HUNDRED AND ELEVEN BILLION, SIX HUNDRED AND FIFTY-FIVE MILLION, FOUR HUNDRED AND NINETY-NINE THOUSAND, ONE HUNDRED AND TWENTY-THREE DOLLARS AND NINETY-NINE CENTS";
            string expectedName   = "John Doe";
            var    controller     = new CurrencyToTextController();

            // act
            var result = controller.GetCurrencyTextValue(expectedName, testValue) as OkNegotiatedContentResult <CurrencyText>;

            // assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Content);
            Assert.AreEqual(expectedOutput, result.Content.valueText);
        }
Exemple #3
0
        public void GetCurrencyTextValue_ShouldReturnCorrectResult()
        {
            // arrange
            string testValue      = "123.45";
            string expectedOutput = "ONE HUNDRED AND TWENTY-THREE DOLLARS AND FORTY-FIVE CENTS";
            string expectedName   = "John Doe";
            var    controller     = new CurrencyToTextController();

            // act
            var result = controller.GetCurrencyTextValue(expectedName, testValue) as OkNegotiatedContentResult <CurrencyText>;

            // assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Content);
            Assert.AreEqual(expectedOutput, result.Content.valueText);
            Assert.AreEqual(expectedName, result.Content.name);
        }