コード例 #1
0
 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);
 }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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);
        }