Ejemplo n.º 1
0
        public void Add_User_Data()
        {
            List <string> listexp = new List <string>();

            listexp.Add(nickname);
            listexp.Add(fullname);

            var repo = new MockRepository(MockBehavior.Default);

            _mockRestServiceMethods = repo.Create <IRestServiceMethods>();
            _mockUser           = repo.Create <IUser>();
            _testClientPrepair  = new TestClientPrepair(_mockRestServiceMethods.Object);
            _testServicePrepair = new TestServicePrepair(_mockUser.Object);

            _mockRestServiceMethods.Setup(x => x.AddUser(nickname, fullname));
            _mockUser.Setup(x => x.Add(nickname, fullname));

            IUser         us1     = new User();
            List <string> listact = us1.Add(nickname, fullname);

            _testClientPrepair.ADDUSER(nickname, fullname);
            _testServicePrepair.AddUser(nickname, fullname);

            repo.Verify();
            CollectionAssert.AreEqual(listexp, listact);
            foreach (string item in listact)
            {
                Console.WriteLine(item);
            }
        }
Ejemplo n.º 2
0
        public void Remove_User_Data()
        {
            List <string> listexp = new List <string>();

            var repo = new MockRepository(MockBehavior.Default);

            _mockRestServiceMethods = repo.Create <IRestServiceMethods>();
            _mockUser           = repo.Create <IUser>();
            _testClientPrepair  = new TestClientPrepair(_mockRestServiceMethods.Object);
            _testServicePrepair = new TestServicePrepair(_mockUser.Object);

            _mockRestServiceMethods.Setup(x => x.DelUser(nickname));
            _mockUser.Setup(x => x.Del(nickname));

            IUser         us1     = new User();
            List <string> listact = us1.Del(nickname);

            _testClientPrepair.DELETEUSER(nickname);
            _testServicePrepair.DelUser(nickname);

            repo.Verify();
            CollectionAssert.AreEqual(listexp, listact);
        }