2016-11-29 15:42:16 -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.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  FluentAssertions ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Microsoft.Build.Construction ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Microsoft.DotNet.Tools.Test.Utilities ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Msbuild.Tests.Utilities ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  System ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  System.IO ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								using  Xunit ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								namespace  Microsoft.DotNet.Cli.Remove.Reference.Tests  
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  class  GivenDotnetRemoveReference  :  TestBase 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        private  const  string  HelpText  =  @ ".NET Remove Project to Project reference Command
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Usage :  dotnet  remove  < 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 >   Remove  reference  only  when  targetting  a  specific  framework 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 23:59:58 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Additional  Arguments :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 Project  to  project  references  to  remove 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        const  string  FrameworkNet451Arg  =  "-f net451" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  ConditionFrameworkNet451  =  "== 'net451'" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  FrameworkNetCoreApp10Arg  =  "-f netcoreapp1.0" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  string  ConditionFrameworkNetCoreApp10  =  "== 'netcoreapp1.0'" ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        static  readonly  string [ ]  DefaultFrameworks  =  new  string [ ]  {  "netcoreapp1.0" ,  "net451"  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  TestSetup  Setup ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( Setup ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  new  TestSetup ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                TestAssets . Get ( TestSetup . TestGroup ,  TestSetup . ProjectName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . CreateInstance ( callingMethod :  callingMethod ,  identifier :  identifier ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithSourceFiles ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Root 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . FullName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  NewDir ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( NewDir ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  new  ProjDir ( TestAssetsManager . CreateTestDirectory ( callingMethod :  callingMethod ,  identifier :  identifier ) . Path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  NewLib ( [ System . Runtime . CompilerServices . CallerMemberName ]  string  callingMethod  =  nameof ( NewDir ) ,  string  identifier  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  dir  =  NewDir ( callingMethod :  callingMethod ,  identifier :  identifier ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            try 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  NewCommand ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( dir . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . ExecuteWithCapturedOutput ( "-t Lib" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            catch  ( System . ComponentModel . Win32Exception  e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                throw  new  Exception ( $"Intermittent error in `dotnet new` occurred when running it in dir `{dir.Path}`\nException:\n{e}" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -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-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        private  ProjDir  GetLibRef ( TestSetup  setup ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  new  ProjDir ( setup . LibDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  AddLibRef ( TestSetup  setup ,  ProjDir  proj ,  string  additionalArgs  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  ret  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{additionalArgs} \" { ret . CsProjPath } \ "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        private  ProjDir  AddValidRef ( TestSetup  setup ,  ProjDir  proj ,  string  frameworkArg  =  "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  ret  =  new  ProjDir ( setup . ValidRefDir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:08:50 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            new  AddReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{frameworkArg} \" { ret . CsProjPath } \ "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("--help")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("-h")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenHelpOptionIsPassedItPrintsUsage ( string  helpArg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) . Execute ( helpArg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 10:23:26 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("unknownCommandName")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNoCommandIsPassedItPrintsError ( string  commandName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  cmd  =  new  DotnetCommand ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . ExecuteWithCapturedOutput ( $"remove {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-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        [Theory]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("idontexist.csproj")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [InlineData("ihave?inv@lid/char\\acters")]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNonExistingProjectIsPassedItPrintsErrorAndUsage ( string  projName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( projName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            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:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenBrokenProjectIsPassedItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            string  projName  =  "Broken/Broken.csproj" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . WithProject ( projName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            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:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenMoreThanOneProjectExistsInTheDirectoryItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  workingDir  =  Path . Combine ( setup . TestRoot ,  "MoreThanOne" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( workingDir ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojRelToOtherProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            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:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenNoProjectsExistsInTheDirectoryItPrintsErrorAndUsage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            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:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  ItRemovesRefWithoutCondAndPrintsStatus ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddLibRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  ItRemovesRefWithCondAndPrintsStatus ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddLibRef ( setup ,  lib ,  FrameworkNet451Arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( libref . Name ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenTwoDifferentRefsArePresentItDoesNotRemoveBoth ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddLibRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  validref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithoutCondIsNotThereItPrintsMessage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            string  csprojContetntBefore  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{libref.CsProjPath}` could not be found." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( csprojContetntBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenRefWithCondIsNotThereItPrintsMessage ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            string  csprojContetntBefore  =  lib . CsProjContent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{libref.CsProjPath}` could not be found." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lib . CsProjContent ( ) . Should ( ) . BeEquivalentTo ( csprojContetntBefore ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenRefWithAndWithoutCondArePresentAndRemovingNoCondItDoesNotRemoveOther ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefCond  =  AddLibRef ( setup ,  lib ,  FrameworkNet451Arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefNoCond  =  AddLibRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csprojBefore  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  csprojBefore . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  csprojBefore . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { librefNoCond . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( librefNoCond . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( librefCond . Name ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenRefWithAndWithoutCondArePresentAndRemovingCondItDoesNotRemoveOther ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefCond  =  AddLibRef ( setup ,  lib ,  FrameworkNet451Arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefNoCond  =  AddLibRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csprojBefore  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  csprojBefore . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condBefore  =  csprojBefore . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { librefCond . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( librefNoCond . Name ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( librefCond . Name ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
									
										
										
										
											2016-11-29 16:14:05 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        public  void  WhenRefWithDifferentCondIsPresentItDoesNotRemoveIt ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefCondNet451  =  AddLibRef ( setup ,  lib ,  FrameworkNet451Arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  librefCondNetCoreApp10  =  AddLibRef ( setup ,  lib ,  FrameworkNetCoreApp10Arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csprojBefore  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condNet451Before  =  csprojBefore . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  condNetCoreApp10Before  =  csprojBefore . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNetCoreApp10 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"{FrameworkNet451Arg} \" { librefCondNet451 . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNet451 ) . Should ( ) . Be ( condNet451Before  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( librefCondNet451 . Name ,  ConditionFrameworkNet451 ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithConditionContaining ( ConditionFrameworkNetCoreApp10 ) . Should ( ) . Be ( condNetCoreApp10Before ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeAndConditionContaining ( librefCondNetCoreApp10 . Name ,  ConditionFrameworkNetCoreApp10 ) . Should ( ) . Be ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenDuplicateReferencesArePresentItRemovesThemAll ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  proj  =  new  ProjDir ( Path . Combine ( setup . TestRoot ,  "WithDoubledRef" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  removedText  =  $ @ "Project reference `{setup.LibCsprojRelPath}` removed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Project  reference  ` { setup . LibCsprojRelPath } `  removed . ";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            int  noCondBefore  =  proj . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( proj . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( removedText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  csproj  =  proj . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenPassingRefWithRelPathItRemovesRefWithAbsolutePath ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-13 14:31:35 -10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  libref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( lib . Path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojRelToOtherProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenPassingRefWithRelPathToProjectItRemovesRefWithPathRelToProject ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojRelToOtherProjPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenPassingRefWithAbsolutePathItRemovesRefWithRelPath ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  lib  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { setup . ValidRefCsprojPath } \ "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . Be ( $"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed." ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenPassingMultipleReferencesItRemovesThemAll ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  AddLibRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  validref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  outputText  =  $@"Project reference `{Path.Combine(TestSetup.ProjectName, " Lib ", setup.LibCsprojName)}` removed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Project  reference  ` { Path . Combine ( TestSetup . ProjectName ,  setup . ValidRefCsprojRelPath ) } `  removed . ";
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ " \"{validref.CsProjPath}\"" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( outputText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( libref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( validref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        public  void  WhenPassingMultipleReferencesAndOneOfThemDoesNotExistItRemovesOne ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 15:04:32 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  lib  =  NewLibWithFrameworks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  setup  =  Setup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  libref  =  GetLibRef ( setup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  validref  =  AddValidRef ( setup ,  lib ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            string  OutputText  =  $ @ "Project reference `{setup.LibCsprojPath}` could not be found.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-16 15:25:07 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Project  reference  ` { Path . Combine ( TestSetup . ProjectName ,  setup . ValidRefCsprojRelPath ) } `  removed . ";
  
						 
					
						
							
								
									
										
										
										
											2016-12-16 01:04:09 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            int  noCondBefore  =  lib . CsProj ( ) . NumberOfItemGroupsWithoutCondition ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-06 14:16:55 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  cmd  =  new  RemoveReferenceCommand ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . WithWorkingDirectory ( setup . TestRoot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . WithProject ( lib . CsProjPath ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . Execute ( $"\" { libref . CsProjPath } \ " \"{validref.CsProjPath}\"" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cmd . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 13:24:02 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( OutputText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-30 12:07:13 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  csproj  =  lib . CsProj ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfItemGroupsWithoutCondition ( ) . Should ( ) . Be ( noCondBefore  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            csproj . NumberOfProjectReferencesWithIncludeContaining ( validref . Name ) . Should ( ) . Be ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-29 15:42:16 -08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}