@@ -152,53 +152,50 @@ public async Task CreatingPRsAsync(
152152 string targetRepoOwner , string targetBranchName ,
153153 string title , string body )
154154 {
155- using ( TestUtils . WithScheduler ( Scheduler . CurrentThread ) )
156- {
157- var remote = "origin" ;
158- var data = PrepareTestData ( repoName , sourceRepoOwner , sourceBranchName , targetRepoOwner , targetBranchName , "origin" ,
159- repoIsFork , sourceBranchIsTracking ) ;
160-
161- var targetRepo = data . TargetRepo ;
162- var gitClient = data . GitClient ;
163- var l2repo = data . L2Repo ;
164- var activeRepo = data . ActiveRepo ;
165- var sourceBranch = data . SourceBranch ;
166- var targetBranch = data . TargetBranch ;
167- var ms = data . ModelService ;
168-
169- var prservice = new PullRequestService ( data . GitClient , data . GitService , Substitute . For < IVSGitExt > ( ) , Substitute . For < IGraphQLClientFactory > ( ) , data . ServiceProvider . GetOperatingSystem ( ) , Substitute . For < IUsageTracker > ( ) ) ;
170- var vm = new PullRequestCreationViewModel ( data . GetModelServiceFactory ( ) , prservice , data . NotificationService , Substitute . For < IMessageDraftStore > ( ) ) ;
171- await vm . InitializeAsync ( data . ActiveRepo , data . Connection ) ;
172-
173- // the TargetBranch property gets set to whatever the repo default is (we assume master here),
174- // so we only set it manually to emulate the user selecting a different target branch
175- if ( targetBranchName != "master" )
176- vm . TargetBranch = new BranchModel ( targetBranchName , targetRepo ) ;
177-
178- if ( title != null )
179- vm . PRTitle = title ;
180-
181- // this is optional
182- if ( body != null )
183- vm . Description = body ;
184-
185- ms . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , Arg . Any < string > ( ) , Arg . Any < string > ( ) )
186- . Returns ( x =>
187- {
188- var pr = Substitute . For < IPullRequestModel > ( ) ;
189- pr . Base . Returns ( new GitReferenceModel ( "ref" , "label" , "sha" , "https://clone.url" ) ) ;
190- return Observable . Return ( pr ) ;
191- } ) ;
192-
193- await vm . CreatePullRequest . Execute ( ) ;
194-
195- var unused2 = gitClient . Received ( ) . Push ( l2repo , sourceBranchName , remote ) ;
196- if ( ! sourceBranchIsTracking )
197- unused2 = gitClient . Received ( ) . SetTrackingBranch ( l2repo , sourceBranchName , remote ) ;
198- else
199- unused2 = gitClient . DidNotReceiveWithAnyArgs ( ) . SetTrackingBranch ( Args . LibGit2Repo , Args . String , Args . String ) ;
200- var unused = ms . Received ( ) . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , title ?? "Source branch" , body ?? String . Empty ) ;
201- }
155+ var remote = "origin" ;
156+ var data = PrepareTestData ( repoName , sourceRepoOwner , sourceBranchName , targetRepoOwner , targetBranchName , "origin" ,
157+ repoIsFork , sourceBranchIsTracking ) ;
158+
159+ var targetRepo = data . TargetRepo ;
160+ var gitClient = data . GitClient ;
161+ var l2repo = data . L2Repo ;
162+ var activeRepo = data . ActiveRepo ;
163+ var sourceBranch = data . SourceBranch ;
164+ var targetBranch = data . TargetBranch ;
165+ var ms = data . ModelService ;
166+
167+ var prservice = new PullRequestService ( data . GitClient , data . GitService , Substitute . For < IVSGitExt > ( ) , Substitute . For < IGraphQLClientFactory > ( ) , data . ServiceProvider . GetOperatingSystem ( ) , Substitute . For < IUsageTracker > ( ) ) ;
168+ var vm = new PullRequestCreationViewModel ( data . GetModelServiceFactory ( ) , prservice , data . NotificationService , Substitute . For < IMessageDraftStore > ( ) ) ;
169+ await vm . InitializeAsync ( data . ActiveRepo , data . Connection ) ;
170+
171+ // the TargetBranch property gets set to whatever the repo default is (we assume master here),
172+ // so we only set it manually to emulate the user selecting a different target branch
173+ if ( targetBranchName != "master" )
174+ vm . TargetBranch = new BranchModel ( targetBranchName , targetRepo ) ;
175+
176+ if ( title != null )
177+ vm . PRTitle = title ;
178+
179+ // this is optional
180+ if ( body != null )
181+ vm . Description = body ;
182+
183+ ms . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , Arg . Any < string > ( ) , Arg . Any < string > ( ) )
184+ . Returns ( x =>
185+ {
186+ var pr = Substitute . For < IPullRequestModel > ( ) ;
187+ pr . Base . Returns ( new GitReferenceModel ( "ref" , "label" , "sha" , "https://clone.url" ) ) ;
188+ return Observable . Return ( pr ) ;
189+ } ) ;
190+
191+ await vm . CreatePullRequest . Execute ( ) ;
192+
193+ var unused2 = gitClient . Received ( ) . Push ( l2repo , sourceBranchName , remote ) ;
194+ if ( ! sourceBranchIsTracking )
195+ unused2 = gitClient . Received ( ) . SetTrackingBranch ( l2repo , sourceBranchName , remote ) ;
196+ else
197+ unused2 = gitClient . DidNotReceiveWithAnyArgs ( ) . SetTrackingBranch ( Args . LibGit2Repo , Args . String , Args . String ) ;
198+ var unused = ms . Received ( ) . CreatePullRequest ( activeRepo , targetRepo , sourceBranch , targetBranch , title ?? "Source branch" , body ?? String . Empty ) ;
202199 }
203200
204201 [ Test ]
0 commit comments