public void TestNotification() { Customer testCustomer = new Customer { ID=1, name="Shibu Thannikkunnath", department="CSE", emailAddress ="*****@*****.**" }; eStore.eStore estoreObj = new eStore.eStore(new EmailLibrary()); bool isAddedUser = estoreObj.addUser(testCustomer); Assert.AreEqual(isAddedUser, true); }
public virtual bool addUser(Customer customer) { //notify user bool isNotified =_IEmailLibrary.sendEmail("test frome", "test to", "test subject", "test body"); if (isNotified) { return true; } else { return false; } }
public void TestFailedNotification() { Mock<IEmailLibrary> mockEmailLib = new Mock<IEmailLibrary>(); mockEmailLib.Setup(x => x.sendEmail("from email","to email", "test sub","test body")).Returns(false); Customer testCustomer = new Customer { ID = 1, name = "Shibu Thannikkunnath", department = "CSE", emailAddress = "*****@*****.**" }; eStore.eStore estoreObj = new eStore.eStore(mockEmailLib.Object); bool isAddedUser = estoreObj.addUser(testCustomer); Assert.AreEqual(isAddedUser, false); }