Пример #1
0
        public void UnDeleteUserWithValidIdSucceeds()
        {
            var client = new TargetProcessClient {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Users)
            };
            // First, Create a user

            var user = new User {
                FirstName = "Test", LastName = "User", Login = "******", Email = "*****@*****.**", Password = "******"
            };
            var data      = client.CreateUser(user);
            var createdId = data.Data.Id;

            Assert.NotEqual(0, createdId);
            Assert.NotNull(createdId);

            // Then, Delete it
            var result = client.DeleteData <User>((int)createdId);

            Assert.NotNull(result);
            Assert.NotNull(result.Data.Id);

            // Then undelete the user
            var undeleteClient = new TargetProcessClient {
                ApiSiteInfo = new ApiSiteInfo(TargetProcessRoutes.Route.Undelete)
            };
            var undeleteUserData = undeleteClient.UndeleteUserData((int)createdId);

            Assert.NotNull(undeleteUserData);
            Assert.False(undeleteUserData.HttpResponse.IsError);
        }