public void Update() { Mock <IDatabase> mock = new Mock <IDatabase>(); mock.Setup(x => x.Execute(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())).Returns(1); MemberTable membertable = new MemberTable(mock.Object); LibMember member = new LibMember(); member.SetFirstname("Renu"); member.SetLastname("Damodaran"); member.SetEmail("*****@*****.**"); member.SetPhone("9024012836"); member.SetAddress("1144 Quingate Street"); member.SetDob("20-05-1992"); int result = membertable.Update(member); Assert.AreEqual(1, result); }
public void InValid_DeleteMember() { Mock <IDatabase> mock = new Mock <IDatabase>(); mock.Setup(x => x.Execute(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())).Returns(1); MemberController membercontroller = new MemberController(mock.Object); LibMember lib = new LibMember(); //var mock = new Mock<LibMember>(); //member.AddMember(mock.Object); lib.SetFirstname("Anitt"); lib.SetLastname("123"); lib.SetEmail("*****@*****.**"); lib.SetPhone("123456"); lib.SetDob("08-08-1993"); lib.SetAddress(""); var result = membercontroller.DeleteMember("-1") as RedirectToRouteResult; Assert.IsNotNull(result); }
public void AddMemberTest_InValidEmail() { Mock <IDatabase> mock = new Mock <IDatabase>(); mock.Setup(x => x.Execute(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())).Returns(1); MemberController membercontroller = new MemberController(mock.Object); MemberController member = new MemberController(); LibMember lib = new LibMember(); //var mock = new Mock<LibMember>(); //member.AddMember(mock.Object); lib.SetFirstname("Priyanka"); lib.SetLastname("123"); lib.SetEmail(""); lib.SetPhone("123456"); lib.SetDob("08-08-1993"); lib.SetAddress("145 Edward Street"); var result = member.AddMember(lib) as ViewResult; Assert.AreEqual("AddMember", result.ViewName); }