@@ -132,6 +132,7 @@ public void TargetBranchDisplayNameIncludesRepoOwnerWhenFork()
132132 [ InlineData ( "repo-name-8" , "source-repo-owner" , "master" , true , false , "target-repo-owner" , "master" , "title" , "description" ) ]
133133 [ InlineData ( "repo-name-9" , "source-repo-owner" , "source-branch" , false , false , "source-repo-owner" , "target-branch" , "title" , null ) ]
134134 [ InlineData ( "repo-name-10" , "source-repo-owner" , "source-branch" , false , false , "source-repo-owner" , "master" , "title" , "description" ) ]
135+ [ InlineData ( "repo-name-11" , "source-repo-owner" , "source-branch" , false , false , "source-repo-owner" , "master" , null , null ) ]
135136 public async Task CreatingPRs (
136137 string repoName , string sourceRepoOwner , string sourceBranchName ,
137138 bool repoIsFork , bool sourceBranchIsTracking ,
@@ -151,30 +152,31 @@ public async Task CreatingPRs(
151152 var ms = data . ModelService ;
152153
153154 var prservice = new PullRequestService ( data . GitClient , data . GitService , data . ServiceProvider . GetOperatingSystem ( ) , Substitute . For < IUsageTracker > ( ) ) ;
154- var vm = new PullRequestCreationViewModel ( data . RepositoryHost , data . ActiveRepo , prservice , data . NotificationService ) ;
155+ prservice . GetPullRequestTemplate ( data . ActiveRepo ) . Returns ( Observable . Empty < string > ( ) ) ;
155156
157+ var vm = new PullRequestCreationViewModel ( data . RepositoryHost , data . ActiveRepo , prservice , data . NotificationService ) ;
156158 vm . Initialize ( ) ;
157159
158- // the user has to input this
159- vm . PRTitle = title ;
160-
161- // this is optional
162- if ( body != null )
163- vm . Description = body ;
164-
165160 // the TargetBranch property gets set to whatever the repo default is (we assume master here),
166161 // so we only set it manually to emulate the user selecting a different target branch
167162 if ( targetBranchName != "master" )
168163 vm . TargetBranch = new BranchModel ( targetBranchName , targetRepo ) ;
169164
165+ if ( title != null )
166+ vm . PRTitle = title ;
167+
168+ // this is optional
169+ if ( body != null )
170+ vm . Description = body ;
171+
170172 await vm . CreatePullRequest . ExecuteAsync ( ) ;
171173
172174 var unused2 = gitClient . Received ( ) . Push ( l2repo , sourceBranchName , remote ) ;
173175 if ( ! sourceBranchIsTracking )
174176 unused2 = gitClient . Received ( ) . SetTrackingBranch ( l2repo , sourceBranchName , remote ) ;
175177 else
176178 unused2 = gitClient . DidNotReceiveWithAnyArgs ( ) . SetTrackingBranch ( Args . LibGit2Repo , Args . String , Args . String ) ;
177- var unused = ms . Received ( ) . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , title , body ?? String . Empty ) ;
179+ var unused = ms . Received ( ) . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , title ?? "Source branch" , body ?? String . Empty ) ;
178180 }
179181
180182 [ Fact ]
0 commit comments