public void AddGroup() { var groupName = "test-group"; var project = ApiClientHelper.GetFirstProject(); var request = _builder.GetAddKeywordGroupRequest(project.Id, groupName); var id = _client.GetMessageResult(request); Assert.IsTrue(id > 0, "id > 0"); }
public void DropProject() { var dropProject = ApiClientHelper.GetFirstProject(); var request = _builder.GetDeleteProjectRequest(dropProject.Id); var res = _client.GetBoolResult(request); Assert.IsTrue(res); var newProjects = ApiClientHelper.GetProjects(); Assert.IsNull(newProjects.FirstOrDefault(p => p.Id == dropProject.Id)); }
public void AddProject() { var site = "http://ya.ru"; var request = _builder.GetAddProjectRequest(site); var projectId = _client.GetMessageResult(request); Assert.IsTrue(projectId >= 0, "id >= 0"); var newProject = ApiClientHelper.GetFirstProject(projectId); Assert.AreEqual(site.Replace("http://", ""), newProject.Site); }
public void DropKeyword() { var project = ApiClientHelper.GetFirstProject(); var keyword = GetKeywords(project.Id).First(); var request = _builder.GetDeleteKeywordRequest(keyword.Id); var res = _client.GetBoolResult(request); Assert.IsTrue(res); var keywords = GetKeywords(project.Id); Assert.IsNull(keywords.FirstOrDefault(k => k.Id == keyword.Id)); }
public void EnableDisableProject() { var project = ApiClientHelper.GetFirstProject(); var newState = (project.On == 0) ? -1 : 0; var request = _builder.GetUpdateProjectRequest(project.Id, newState); var res = _client.GetBoolResult(request); Assert.IsTrue(res); var projects = ApiClientHelper.GetProjects(false); var newProject = projects.First(p => project.Id == p.Id); Assert.AreEqual(newProject.On, newState); }
public void SetKeywordTarget() { var project = ApiClientHelper.GetFirstProject(); var keyword = GetKeywords(project.Id).First(); var url = "http://ya.ru/phrase" + Environment.TickCount; var request = _builder.GetUpdateKeywordTargetRequest(keyword.Id, url); var res = _client.GetBoolResult(request); // BUG: непонятно почему, но таргет устанавливается, а возвращает 0 //Assert.IsTrue(res); var keywords = GetKeywords(project.Id); Assert.IsNotNull(keywords.FirstOrDefault(k => k.Target == url)); }
public void AddSingleKeyword() { var testPhrase = "test phrase" + Environment.TickCount; var project = ApiClientHelper.GetFirstProject(); var request = _builder.GetAddKeywordRequest(project.Id, testPhrase); var id = _client.GetMessageResult(request); Assert.IsTrue(id > 0, "id > 0"); var keywords = GetKeywords(project.Id); var newKeyword = keywords.First(k => k.Id == id); Assert.AreEqual(testPhrase, newKeyword.Phrase); }
public void AddSomeKeywords() { var addKeywords = new List <string>(); for (int i = 0; i < 5; ++i) { addKeywords.Add("phrase " + Environment.TickCount); } var project = ApiClientHelper.GetFirstProject(); var request = _builder.GetAddKeywordsRequest(project.Id, addKeywords); _client.GetMessageResult(request); var keywords = GetKeywords(project.Id); foreach (var addedWord in addKeywords) { Assert.IsNotNull(keywords.FirstOrDefault(k => k.Phrase == addedWord)); } }
public void LoadKeywords() { var project = ApiClientHelper.GetFirstProject(); var keywords = GetKeywords(project.Id); }