public void TestGetUsersXml() { var service = new TestWebService(); var res = service.GetUsersXml(); Assert.IsInstanceOfType(res, typeof(User[])); }
public void TestRepoException() { var repo = new Mock <IRepository>(); repo.Setup(r => r.GetUsers()).Throws(new Exception("Error")); var service = new TestWebService(repo.Object, new CryptographerMP5()); var res = service.GetUsersXml(); }
public void TestCryptoException() { var repo = new Mock <IRepository>(); repo.Setup(r => r.GetUsers()).Returns(new User[] { new User() { id = 1, name = "test" } }); var crypto = new Mock <ICryptographer>(); crypto.Setup(c => c.Encrypt(It.IsAny <string>())).Throws(new Exception("Error")); var service = new TestWebService(repo.Object, crypto.Object); var res = service.GetUsersXml(); }