public void AddSubscription_Valid_SubscriptionStatus() { Mock <ISubscriptionRepository> acr = new Mock <ISubscriptionRepository>(); acr.Setup(p => p.AddSubscription(db, "Token")).Returns("Your Subscription Added Successfully!"); SubscriptionController contr = new SubscriptionController(acr.Object); var data = contr.Add_Subscription(db) as OkObjectResult; Assert.AreEqual(200, data.StatusCode); }
public void AddSubscription_InValid_SubscriptionStatus() { Mock <ISubscriptionRepository> mock = new Mock <ISubscriptionRepository>(); mock.Setup(p => p.AddSubscription(sub, "Token")).Returns("Sorry! Subscription Not Possible Due To Unavailable drug."); SubscriptionController obj = new SubscriptionController(mock.Object); var res = obj.Add_Subscription(sub) as OkObjectResult; Assert.AreEqual(200, res.StatusCode); }