PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Atlassian.Jira.Test/CustomFieldTest.cs

https://bitbucket.org/yyo/atlassian.net-sdk-v2.0
C# | 43 lines | 38 code | 3 blank | 2 comment | 0 complexity | da59dc5f9bd6aae27c8df4109398c328 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Xunit;
  6. using Atlassian.Jira.Remote;
  7. using Moq;
  8. namespace Atlassian.Jira.Test
  9. {
  10. public class CustomFieldTest
  11. {
  12. [Fact]
  13. public void Name_ShouldRetriveValueFromRemote()
  14. {
  15. //arrange
  16. var jira = TestableJira.Create();
  17. jira.SoapService
  18. .Setup(c => c.GetIssuesFromJqlSearch(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()))
  19. .Returns(new RemoteIssue[]
  20. {
  21. new RemoteIssue() { key = "123" }
  22. });
  23. jira.SoapService.Setup(c => c.GetFieldsForEdit(It.IsAny<string>(), "123")).Returns(new RemoteField[] {
  24. new RemoteField(){ id="123", name= "CustomField" }});
  25. var issue = new RemoteIssue()
  26. {
  27. project = "bar",
  28. key = "foo",
  29. customFieldValues = new RemoteCustomFieldValue[]{
  30. new RemoteCustomFieldValue(){
  31. customfieldId = "123",
  32. values = new string[] {"abc"}
  33. }
  34. }
  35. }.ToLocal(jira);
  36. //assert
  37. Assert.Equal("CustomField", issue.CustomFields[0].Name);
  38. }
  39. }
  40. }