public void DeleteIncident_Test() { const string testString = "Test Test Test"; var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = _testIncidentName, Description = testString }; _client.Create(incident); Assert.IsNotNull(incident.RecId); _client.Delete(incident); var incidentQuery = _client.GetQuery<TestIncident>().ForRecId(incident.RecId); var incidents = _client.ExecuteQuery(incidentQuery); Assert.AreEqual(0, incidents.Count()); }
public void GetAttachment_Test() { const string testString = "Test Test Test"; var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = _testIncidentName, Description = testString }; _client.Create(incident); _client.AttachFileToObject(incident, _tmpFileList); var streams = _client.GetAttachmentsFromObject(incident); Assert.AreEqual(_client.HasAttachments(incident), streams.Count()); }
public void CreateIncident_WithNoCustomer_Test() { var incident = new TestIncident(); _client.Create(incident); }
public void CreateIncident_WithDefaultCustomer_Test() { const string testString = "Test Test Test"; var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = _testIncidentName, Description = testString }; _client.Create(incident); Assert.IsNotNull(incident.RecId); }
public void UpdateIncident_Description_Test() { var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = _testIncidentName, Description = "Test Test Test" }; _client.Create(incident); Assert.IsNotNull(incident.RecId); Assert.AreEqual("Test Test Test", incident.Description); incident.Description = "Test Updated Description"; _client.Update(incident); var incidentQuery = _client.GetQuery<TestIncident>().ForRecId(incident.RecId); var sameIncident = _client.ExecuteQuery(incidentQuery); Assert.AreEqual("Test Updated Description", sameIncident.First().Description); _client.Delete(incident); }
public void UpdateIncident_WithValidatorValidation_Test() { var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = _testIncidentName, Description = "Test Test Test" }; _client.Create(incident); Assert.IsNotNull(incident.RecId); Assert.AreEqual("Test Test Test", incident.Description); incident.Title = "throw exception"; var threwException = false; try { _client.Update(incident); } catch (CsmValidationException e) { threwException = true; } Assert.IsTrue(threwException); _client.Delete(incident); }
public void UpdateIncident_UpdateFails_UpdateIsRolledBack() { var testTitle = "Test Incident 2"; var incident = new TestIncident { CustomerId = _defaultCustomerId, Title = testTitle, Description = "Test Test Test" }; _client.Create(incident); Assert.IsNotNull(incident.RecId); Assert.AreEqual("Test Test Test", incident.Description); incident.Description = "Changed Test"; incident.Title = "throw exception"; try { _client.Update(incident); } catch { // Swallow the exception so we can confirm that our updates were rolled back } var readIncident = _client.ExecuteQuery(_client.GetQuery<TestIncident>().Where(x => x.Title == testTitle)).Single(); Assert.AreEqual("Test Test Test", readIncident.Description); _client.Delete(incident); }