예제 #1
0
        public void TestGetUsersXml()
        {
            var service = new TestWebService();

            var res = service.GetUsersXml();

            Assert.IsInstanceOfType(res, typeof(User[]));
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }