Esempio n. 1
0
        public void ConvertNumtoAlphaTest()
        {
            Mock <IConvertAmount> convertAmtObj           = new Mock <IConvertAmount>();
            ConversionController  conversionControllerObj = new ConversionController(convertAmtObj.Object);
            PersonDetail          personDetails           = new PersonDetail();

            personDetails.Name   = "Hemant";
            personDetails.Amount = "123";
            var result = conversionControllerObj.ConvertNumtoAlpha(personDetails) as JsonResult;

            var mockResult = GetTestPersonDetails();

            Assert.AreEqual(result.Data, mockResult.Data);
        }
Esempio n. 2
0
        public void ConvertNumtoAlphaTest()
        {
            Mock <IConvertAmount> convertAmtObj = new Mock <IConvertAmount>();
            PersonDetail          personDetails = new PersonDetail();

            personDetails.Name   = "Hemant";
            personDetails.Amount = "123";

            PersonDetail personDetailsMock = new PersonDetail()
            {
                Name = "Hemant", Amount = "one hundred and twenty three dollar"
            };

            convertAmtObj.Setup(x => x.ConvertAmountToAplha(personDetails)).Returns(personDetailsMock);
            ConversionController conversionControllerObj = new ConversionController(convertAmtObj.Object);

            var result = conversionControllerObj.ConvertNumtoAlpha(personDetails) as JsonResult;

            Assert.AreEqual(200, GetVal <int>(result, "StatusCode"));
            Assert.AreEqual("Hemant", GetVal <PersonDetail>(result, "outPut").Name);
            Assert.AreEqual("one hundred and twenty three dollar", GetVal <PersonDetail>(result, "outPut").Amount);
        }