Ejemplo n.º 1
0
        public void ApiTV_AddProjectToTv_ListOfProjectsContainsThisOne()
        {
            // arrange
            var project = new Project() {Name = "projectTest"};
            List<Project> listOfProject = new List<Project>();
            listOfProject.Add(project);

            // act
            TopVisorHelper.AddProjectInTv(listOfProject);

            //assert
            var listOfProjectsInTV = TopVisorHelper.GetListOfProjectFromTopVisor();
            Assert.IsNotNull(listOfProjectsInTV.Select(proj => proj.Name = project.Name));
        }
Ejemplo n.º 2
0
        public void ApiTV_DeleteProjectFromTv_ListOfProjectsDoesnotContainThisOne()
        {
            // arrange
            var project = new Project() { Name = "projectTest" };
            List<Project> listOfProject = new List<Project>();
            listOfProject.Add(project);
            TopVisorHelper.AddProjectInTv(listOfProject);
            var listOfProjectsInTV = TopVisorHelper.GetListOfProjectFromTopVisor();
            var projectId = listOfProjectsInTV.FirstOrDefault(item => item.Name == project.Name).Id;
            project.Id = projectId;
            Thread.Sleep(10000);

            // act
            TopVisorHelper.DeleteProjectInTv(listOfProject);

            //assert
            Thread.Sleep(10000);
            var result = TopVisorHelper.GetListOfProjectFromTopVisor();
            Assert.IsNull(listOfProjectsInTV.Select(proj => proj.Name = project.Name));
        }
Ejemplo n.º 3
0
 public static List<Project> GetListOfProjectFromTopVisor()
 {
     var list = new List<Project>();
     string data = "api_key=912be009ca2d1f815a80&oper=get&module=mod_projects";
     WebRequest req = WebRequest.Create(Url + "?" + data);
     WebResponse resp = req.GetResponse();
     Stream stream = resp.GetResponseStream();
     StreamReader sr = new StreamReader(stream);
     string Out = sr.ReadToEnd();
     var arrayOfProject = Json.Decode(Out);
     foreach (var project in arrayOfProject)
     {
         var a = new Project();
         a.Id = Convert.ToInt32(project.Id);
         a.Name = project.Name;
         //a.KeyWords = project.KeyWords;
         list.Add(a);
     }
     sr.Close();
     return list;
 }