示例#1
0
        public void CreateIssuePreviewAsync_TeamNameIsNotNull_ChainsThroughCorrectly()
        {
            using (ShimsContext.Create())
            {
                const string expectedProjectName = "Ultra Project";
                const string expectedTeamName    = "Ultra Team";
                string       actualProjectName   = null;
                string       actualTeamName      = null;
                Uri          expectedUri         = new Uri("https://www.bing.com");

                AzureDevOpsIntegration integration = new ShimAzureDevOpsIntegration
                {
                    CreateIssuePreviewStringStringIReadOnlyDictionaryOfAzureDevOpsFieldString = (p, t, f) =>
                    {
                        actualProjectName = p;
                        actualTeamName    = t;
                        return(expectedUri);
                    },
                    ConnectedToAzureDevOpsGet = () => true,
                };

                ShimAzureDevOpsIntegration.GetCurrentInstance = () => integration;

                ConnectionInfo connectionInfo = new ConnectionInfo(expectedUri,
                                                                   new TeamProject(expectedProjectName, Guid.Empty),
                                                                   new Team(expectedTeamName, Guid.Empty));
                IssueInformation issueInfo = new IssueInformation();

                Uri actualUri = FileIssueHelpers.CreateIssuePreviewAsync(connectionInfo, issueInfo).Result;

                Assert.AreEqual(expectedUri, actualUri);
                Assert.AreEqual(expectedProjectName, actualProjectName);
                Assert.AreEqual(expectedTeamName, actualTeamName);
            }
        }
示例#2
0
 public void CreateIssuePreviewAsync_IssueInfoIsNull_ThrowsArgumentNullException()
 {
     _fileIssueHelpers.CreateIssuePreviewAsync(new ConnectionInfo(), null);
 }