2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Copyright (c) .NET Foundation and contributors. All rights reserved.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Licensed under the MIT license. See LICENSE file in the project root for full license information.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 14:41:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  FluentAssertions ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Microsoft.Build.Construction ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Microsoft.DotNet.Tools.Test.Utilities ;  
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  Msbuild.Tests.Utilities ;  
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								using  System ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  System.IO ;  
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  System.Linq ;  
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								using  Xunit ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								namespace  Microsoft.DotNet.Cli.Add.Reference.Tests  
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  class  GivenDotnetAddReference  :  TestBase 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        private  const  string  HelpText  =  @ ".NET Add Project to Project reference Command
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Usage :  dotnet  add  < PROJECT >  reference  [ options ]  [ args ]  
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Arguments :  
						 
					
						
							
								
									
										
										
										
											2017-01-06 10:58:23 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  < PROJECT >   The  project  file  to  operate  on .  If  a  file  is  not  specified ,  the  command  will  search  the  current  directory  for  one . 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Options :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  - h | - - help                    Show  help  information 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  - f | - - framework  < FRAMEWORK >   Add  reference  only  when  targetting  a  specific  framework 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 23:59:58 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Additional  Arguments :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 Project  to  project  references  to  add 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        const  string  FrameworkNet451Arg  =  "-f net451" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  ConditionFrameworkNet451  =  "== 'net451'" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  FrameworkNetCoreApp10Arg  =  "-f netcoreapp1.0" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  ConditionFrameworkNetCoreApp10  =  "== 'netcoreapp1.0'" ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-09 12:11:11 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  string  ProjectNotCompatibleErrorMessageRegEx  =  "Project `[^`]*` cannot be added due to incompatible targeted frameworks between the two projects\\. Please review the project you are trying to add and verify that is compatible with the following targets\\:" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  ProjectDoesNotTargetFrameworkErrorMessageRegEx  =  "Project `[^`]*` does not target framework `[^`]*`." ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        static  readonly  string [ ]  DefaultFrameworks  =  new  string [ ]  {  "netcoreapp1.0" ,  "net451"  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        private  TestSetup  Setup ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( Setup ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  new  TestSetup ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 14:41:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                TestAssets . Get ( TestSetup . TestGroup ,  TestSetup . ProjectName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-23 13:46:44 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . CreateInstance ( callingMethod :  callingMethod ,  identifier :  identifier ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 14:41:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithSourceFiles ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Root 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . FullName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  NewDir ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( NewDir ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 14:41:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  new  ProjDir ( TestAssetsManager . CreateTestDirectory ( callingMethod :  callingMethod ,  identifier :  identifier ) . Path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  NewLib ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( NewDir ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 14:41:56 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  dir  =  NewDir ( callingMethod :  callingMethod ,  identifier :  identifier ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            try 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  NewCommand ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( dir . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . ExecuteWithCapturedOutput ( "-t Lib" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            catch  ( System . ComponentModel . Win32Exception  e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                throw  new  Exception ( $"Intermittent error in `dotnet new` occurred when running it in dir `{dir.Path}`\nException:\n{e}" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        private  static  void  SetTargetFrameworks ( ProjDir  proj ,  string [ ]  frameworks ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . AddProperty ( "TargetFrameworks" ,  string . Join ( ";" ,  frameworks ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . Save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  NewLibWithFrameworks ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( NewDir ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  ret  =  NewLib ( callingMethod :  callingMethod ,  identifier :  identifier ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            SetTargetFrameworks ( ret ,  DefaultFrameworks ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("--help")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("-h")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenHelpOptionIsPassedItPrintsUsage ( string  helpArg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) . Execute ( helpArg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 10:23:26 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("unknownCommandName")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNoCommandIsPassedItPrintsError ( string  commandName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  cmd  =  new  DotnetCommand ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . ExecuteWithCapturedOutput ( $"add {commandName}" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Fail ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( "Required command was not provided." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenTooManyArgumentsArePassedItPrintsError ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithProject ( "one two three" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( "proj.csproj" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . ExitCode . Should ( ) . NotBe ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( "Unrecognized command or argument 'two'" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Specify --help for a list of available options and commands." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("idontexist.csproj")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("ihave?inv@lid/char\\acters")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNonExistingProjectIsPassedItPrintsErrorAndUsage ( string  projName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( projName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . ExitCode . Should ( ) . NotBe ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( $"Could not find project or directory `{projName}`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenBrokenProjectIsPassedItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            string  projName  =  "Broken/Broken.csproj" ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( projName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . ExitCode . Should ( ) . NotBe ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( "Project `Broken/Broken.csproj` is invalid." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenMoreThanOneProjectExistsInTheDirectoryItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  workingDir  =  Path . Combine ( setup . TestRoot ,  "MoreThanOne" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( workingDir ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojRelToOtherProjPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . ExitCode . Should ( ) . NotBe ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( $"Found more than one project in `{workingDir + Path.DirectorySeparatorChar}`. Please specify which one to use." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNoProjectsExistsInTheDirectoryItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . ExitCode . Should ( ) . NotBe ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( $"Could not find any project in `{setup.TestRoot + Path.DirectorySeparatorChar}`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItAddsRefWithoutCondAndPrintsStatus ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . BeEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItAddsRefWithCondAndPrintsStatus ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . BeEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . ValidRefCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithoutCondIsPresentItAddsDifferentRefWithoutCond ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . LibCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondIsPresentItAddsDifferentRefWithCond ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . LibCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . ValidRefCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondIsPresentItAddsRefWithDifferentCond ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNetCoreApp10Arg} \" { setup . ValidRefCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . ValidRefCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithConditionIsPresentItAddsDifferentRefWithoutCond ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . LibCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithNoCondAlreadyExistsItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondOnItemAlreadyExistsItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithExistingRefCondOnItem" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  contentBefore  =  proj . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( proj . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"{FrameworkNet451Arg} \" { setup . LibCsprojRelPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `..\\Lib\\Lib.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            proj . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondOnItemGroupAlreadyExistsItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csprojContentBefore  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( csprojContentBefore ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondWithWhitespaceOnItemGroupExistsItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithExistingRefCondWhitespaces" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  contentBefore  =  proj . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( proj . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"{FrameworkNet451Arg} \" { setup . LibCsprojRelPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `..\\Lib\\Lib.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            proj . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithoutCondAlreadyExistsInNonUniformItemGroupItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithRefNoCondNonUniform" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  contentBefore  =  proj . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( proj . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . LibCsprojRelPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `..\\Lib\\Lib.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            proj . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithoutCondAlreadyExistsInNonUniformItemGroupItAddsDifferentRefInDifferentGroup ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithRefNoCondNonUniform" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  proj . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondAlreadyExistsInNonUniformItemGroupItDoesntDuplicate ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithRefCondNonUniform" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  contentBefore  =  proj . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( proj . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"{FrameworkNet451Arg} \" { setup . LibCsprojRelPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Project already has a reference to `..\\Lib\\Lib.csproj`." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            proj . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondAlreadyExistsInNonUniformItemGroupItAddsDifferentRefInDifferentGroup ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithRefCondNonUniform" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  proj . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"{FrameworkNet451Arg} \" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . ValidRefCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenEmptyItemGroupPresentItAddsRefInIt ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "EmptyItemGroup" ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  proj . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItAddsMultipleRefsNoCondToTheSameItemGroup ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  string  OutputText  =  @ "Reference `DotnetAddP2PProjects\Lib\Lib.csproj` added to the project.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Reference  ` DotnetAddP2PProjects \ ValidRef \ ValidRef . csproj `  added  to  the  project . ";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . LibCsprojPath } \ " \"{setup.ValidRefCsprojPath}\"" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( OutputText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . LibCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItAddsMultipleRefsWithCondToTheSameItemGroup ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  string  OutputText  =  @ "Reference `DotnetAddP2PProjects\Lib\Lib.csproj` added to the project.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Reference  ` DotnetAddP2PProjects \ ValidRef \ ValidRef . csproj `  added  to  the  project . ";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg}  \" { setup . LibCsprojPath } \ " \"{setup.ValidRefCsprojPath}\"" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:18:54 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( OutputText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . ValidRefCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( setup . LibCsprojName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        public  void  WhenProjectNameIsNotPassedItFindsItAndAddsReference ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . BeEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenPassedReferenceDoesNotExistItShowsAnError ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  contentBefore  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( "\"IDoNotExist.csproj\"" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Fail ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( "Reference IDoNotExist.csproj does not exist." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenPassedMultipleRefsAndOneOfthemDoesNotExistItCancelsWholeOperation ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  contentBefore  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ " \"IDoNotExist.csproj\"" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Fail ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( "Reference IDoNotExist.csproj does not exist." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 10:45:45 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( contentBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenPassedReferenceIsUsingSlashesItNormalizesItToBackslashes ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 14:56:31 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjName ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath . Replace ( '\\' ,  '/' ) } \ "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `DotnetAddP2PProjects\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . BeEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojRelPath . Replace ( '/' ,  '\\' ) ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-21 11:38:25 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenReferenceIsRelativeAndProjectIsNotInCurrentDirectoryReferencePathIsFixed ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  proj . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( setup . LibCsprojPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojRelPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\ValidRef\\ValidRef.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 13:58:16 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . BeEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-23 14:02:19 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( setup . ValidRefCsprojRelToOtherProjPath . Replace ( '/' ,  '\\' ) ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-12-09 12:11:11 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  ItCanAddReferenceWithConditionOnCompatibleFramework ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  net45lib  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "Net45Lib" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"{FrameworkNet451Arg} \" { net45lib . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\Net45Lib\\Net45Lib.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( net45lib . CsProjName ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItCanAddRefWithoutCondAndTargetingSupersetOfFrameworksAndOneOfReferencesCompatible ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  net452netcoreapp10lib  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "Net452AndNetCoreApp10Lib" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  net452netcoreapp10lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithProject ( net452netcoreapp10lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { lib . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( "Reference `..\\Lib\\Lib.csproj` added to the project." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  net452netcoreapp10lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( lib . CsProjName ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("net45")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("net40")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("netcoreapp1.1")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("nonexistingframeworkname")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenFrameworkSwitchIsNotMatchingAnyOfTargetedFrameworksItPrintsError ( string  framework ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  net45lib  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "Net45Lib" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csProjContent  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"-f {framework} \" { net45lib . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Fail ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . Be ( $"Project `{setup.LibCsprojPath}` does not target framework `{framework}`." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( csProjContent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("-f net45")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenIncompatibleFrameworkDetectedItPrintsError ( string  frameworkArg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  net45lib  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "Net45Lib" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csProjContent  =  net45lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithProject ( net45lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"{frameworkArg} \" { lib . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Fail ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-09 12:11:11 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . MatchRegex ( ProjectNotCompatibleErrorMessageRegEx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:15:35 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdErr . Should ( ) . MatchRegex ( " - net45" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 16:23:21 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            net45lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( csProjContent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-16 15:49:25 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-23 14:02:19 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}