@@ -584,8 +584,11 @@ static PullRequestService CreatePullRequestService(Repository repo)
584584 static LocalRepositoryModel CreateLocalRepositoryModel ( Repository repo )
585585 {
586586 var repoDir = repo . Info . WorkingDirectory ;
587- var repositoryModel = Substitute . For < LocalRepositoryModel > ( ) ;
588- repositoryModel . LocalPath . Returns ( repoDir ) ;
587+ var repositoryModel = new LocalRepositoryModel
588+ {
589+ LocalPath = repoDir
590+ } ;
591+
589592 return repositoryModel ;
590593 }
591594
@@ -598,7 +601,8 @@ public async Task ExtractsExistingFile_Async()
598601 {
599602 var gitClient = MockGitClient ( ) ;
600603 var target = CreateTarget ( gitClient ) ;
601- var repository = Substitute . For < LocalRepositoryModel > ( ) ;
604+ var repository = new LocalRepositoryModel { } ;
605+
602606 var fileContent = "file content" ;
603607 var pr = CreatePullRequest ( ) ;
604608
@@ -620,7 +624,7 @@ public async Task CreatesEmptyFileForNonExistentFileAsync()
620624 {
621625 var gitClient = MockGitClient ( ) ;
622626 var target = CreateTarget ( gitClient ) ;
623- var repository = Substitute . For < LocalRepositoryModel > ( ) ;
627+ var repository = new LocalRepositoryModel { } ;
624628 var pr = CreatePullRequest ( ) ;
625629
626630 gitClient . ExtractFile ( Arg . Any < IRepository > ( ) , "123" , "filename" ) . Returns ( GetFileTaskAsync ( null ) ) ;
@@ -647,7 +651,7 @@ public async Task CanChangeEncodingAsync(string encodingName)
647651 var fileContent = "file content" ;
648652 var gitClient = MockGitClient ( ) ;
649653 var target = CreateTarget ( gitClient ) ;
650- var repository = Substitute . For < LocalRepositoryModel > ( ) ;
654+ var repository = new LocalRepositoryModel { } ;
651655 var pr = CreatePullRequest ( ) ;
652656
653657 var expectedPath = Path . Combine ( repoDir , fileName ) ;
@@ -730,7 +734,7 @@ public async Task ShouldCheckoutExistingBranchAsync()
730734 var gitClient = MockGitClient ( ) ;
731735 var service = CreateTarget ( gitClient , MockGitService ( ) ) ;
732736
733- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
737+ var localRepo = new LocalRepositoryModel { } ;
734738
735739 var pr = new PullRequestDetailModel
736740 {
@@ -753,9 +757,10 @@ public async Task ShouldCheckoutLocalBranchAsync()
753757 {
754758 var gitClient = MockGitClient ( ) ;
755759 var service = CreateTarget ( gitClient , MockGitService ( ) ) ;
756-
757- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
758- localRepo . CloneUrl . Returns ( new UriString ( "https://foo.bar/owner/repo" ) ) ;
760+ var localRepo = new LocalRepositoryModel
761+ {
762+ CloneUrl = new UriString ( "https://foo.bar/owner/repo" )
763+ } ;
759764
760765 var pr = new PullRequestDetailModel
761766 {
@@ -782,9 +787,10 @@ public async Task ShouldCheckoutLocalBranchOwnerCaseMismatchAsync()
782787 {
783788 var gitClient = MockGitClient ( ) ;
784789 var service = CreateTarget ( gitClient , MockGitService ( ) ) ;
785-
786- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
787- localRepo . CloneUrl . Returns ( new UriString ( "https://foo.bar/Owner/repo" ) ) ;
790+ var localRepo = new LocalRepositoryModel
791+ {
792+ CloneUrl = new UriString ( "https://foo.bar/Owner/repo" )
793+ } ;
788794
789795 var pr = new PullRequestDetailModel
790796 {
@@ -811,9 +817,10 @@ public async Task ShouldCheckoutBranchFromForkAsync()
811817 {
812818 var gitClient = MockGitClient ( ) ;
813819 var service = CreateTarget ( gitClient , MockGitService ( ) ) ;
814-
815- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
816- localRepo . CloneUrl . Returns ( new UriString ( "https://foo.bar/owner/repo" ) ) ;
820+ var localRepo = new LocalRepositoryModel
821+ {
822+ CloneUrl = new UriString ( "https://foo.bar/owner/repo" )
823+ } ;
817824
818825 var pr = new PullRequestDetailModel
819826 {
@@ -844,9 +851,10 @@ public async Task ShouldUseUniquelyNamedRemoteForForkAsync()
844851 var gitClient = MockGitClient ( ) ;
845852 var gitService = MockGitService ( ) ;
846853 var service = CreateTarget ( gitClient , gitService ) ;
847-
848- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
849- localRepo . CloneUrl . Returns ( new UriString ( "https://foo.bar/owner/repo" ) ) ;
854+ var localRepo = new LocalRepositoryModel
855+ {
856+ CloneUrl = new UriString ( "https://foo.bar/owner/repo" )
857+ } ;
850858
851859 using ( var repo = gitService . GetRepository ( localRepo . CloneUrl ) )
852860 {
@@ -881,7 +889,7 @@ public async Task ShouldReturnCorrectDefaultLocalBranchNameAsync()
881889 {
882890 var service = CreateTarget ( MockGitClient ( ) , MockGitService ( ) ) ;
883891
884- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
892+ var localRepo = new LocalRepositoryModel { } ;
885893 var result = await service . GetDefaultLocalBranchName ( localRepo , 123 , "Pull requests can be \" named\" all sorts of thing's (sic)" ) ;
886894 Assert . That ( "pr/123-pull-requests-can-be-named-all-sorts-of-thing-s-sic" , Is . EqualTo ( result ) ) ;
887895 }
@@ -897,7 +905,7 @@ public async Task ShouldReturnCorrectDefaultLocalBranchNameForPullRequestsWithNo
897905 Substitute . For < IOperatingSystem > ( ) ,
898906 Substitute . For < IUsageTracker > ( ) ) ;
899907
900- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
908+ var localRepo = new LocalRepositoryModel { } ;
901909 var result = await service . GetDefaultLocalBranchName ( localRepo , 123 , "コードをレビューする準備ができたこと" ) ;
902910 Assert . That ( "pr/123" , Is . EqualTo ( result ) ) ;
903911 }
@@ -907,7 +915,7 @@ public async Task DefaultLocalBranchNameShouldNotClashWithExistingBranchNamesAsy
907915 {
908916 var service = CreateTarget ( MockGitClient ( ) , MockGitService ( ) ) ;
909917
910- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
918+ var localRepo = new LocalRepositoryModel { } ;
911919 var result = await service . GetDefaultLocalBranchName ( localRepo , 123 , "foo1" ) ;
912920 Assert . That ( "pr/123-foo1-3" , Is . EqualTo ( result ) ) ;
913921 }
@@ -919,9 +927,10 @@ public class TheGetLocalBranchesMethod
919927 public async Task ShouldReturnPullRequestBranchForPullRequestFromSameRepositoryAsync ( )
920928 {
921929 var service = CreateTarget ( MockGitClient ( ) , MockGitService ( ) ) ;
922-
923- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
924- localRepo . CloneUrl . Returns ( new UriString ( "https://github.com/foo/bar" ) ) ;
930+ var localRepo = new LocalRepositoryModel
931+ {
932+ CloneUrl = new UriString ( "https://github.com/foo/bar" )
933+ } ;
925934
926935 var result = await service . GetLocalBranches ( localRepo , CreatePullRequest ( fromFork : false ) ) ;
927936
@@ -932,9 +941,10 @@ public async Task ShouldReturnPullRequestBranchForPullRequestFromSameRepositoryA
932941 public async Task ShouldReturnPullRequestBranchForPullRequestFromSameRepositoryOwnerCaseMismatchAsync ( )
933942 {
934943 var service = CreateTarget ( MockGitClient ( ) , MockGitService ( ) ) ;
935-
936- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
937- localRepo . CloneUrl . Returns ( new UriString ( "https://github.com/Foo/bar" ) ) ;
944+ var localRepo = new LocalRepositoryModel
945+ {
946+ CloneUrl = new UriString ( "https://github.com/Foo/bar" )
947+ } ;
938948
939949 var result = await service . GetLocalBranches ( localRepo , CreatePullRequest ( fromFork : false ) ) ;
940950
@@ -964,8 +974,10 @@ public async Task ShouldReturnMarkedBranchForPullRequestFromForkAsync()
964974
965975 var service = CreateTarget ( MockGitClient ( ) , MockGitService ( repo ) ) ;
966976
967- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
968- localRepo . CloneUrl . Returns ( new UriString ( "https://github.com/foo/bar.git" ) ) ;
977+ var localRepo = new LocalRepositoryModel
978+ {
979+ CloneUrl = new UriString ( "https://github.com/foo/bar.git" )
980+ } ;
969981
970982 var result = await service . GetLocalBranches ( localRepo , CreatePullRequest ( true ) ) ;
971983
@@ -1003,9 +1015,10 @@ public async Task ShouldRemoveUnusedRemoteAsync()
10031015 var gitClient = MockGitClient ( ) ;
10041016 var gitService = MockGitService ( ) ;
10051017 var service = CreateTarget ( gitClient , gitService ) ;
1006-
1007- var localRepo = Substitute . For < LocalRepositoryModel > ( ) ;
1008- localRepo . CloneUrl . Returns ( new UriString ( "https://github.com/foo/bar" ) ) ;
1018+ var localRepo = new LocalRepositoryModel
1019+ {
1020+ CloneUrl = new UriString ( "https://github.com/foo/bar" )
1021+ } ;
10091022
10101023 using ( var repo = gitService . GetRepository ( localRepo . CloneUrl ) )
10111024 {
0 commit comments