예제 #1
0
        public void RequestAdhocRefill_Valid_RefillDetails()
        {
            Mock <IRefillRepository> mock = new Mock <IRefillRepository>();

            mock.Setup(p => p.requestAdhocRefill(ol, "Token")).Returns(cust);

            RefillController obj = new RefillController(mock.Object);
            var res = obj.requestAdhocRefill(ol) as OkObjectResult;

            Assert.AreEqual(200, res.StatusCode);
        }
예제 #2
0
        public void RequestAdhocRefill_InValid_RefillDetails()
        {
            try
            {
                Mock <IRefillRepository> mock = new Mock <IRefillRepository>();
                mock.Setup(p => p.requestAdhocRefill(rl, "Token")).Returns(null);

                RefillController obj = new RefillController(mock.Object);
                var res = obj.requestAdhocRefill(rl) as OkObjectResult;
                Assert.AreEqual(200, res.StatusCode);
            }
            catch (Exception e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }