2016-06-09 20:52:49 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								//                      
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
										 
							
							
								//                                    
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  System ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  System.IO ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  System.Collections.Generic ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  Microsoft.DotNet.Cli.Utils ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  Microsoft.DotNet.Cli ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  Microsoft.DotNet.TestFramework ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  Microsoft.DotNet.Tools.Test.Utilities ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  Xunit ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								using  FluentAssertions ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								namespace  Microsoft.DotNet.Tests  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
									public  class  GivenThatTheUserIsRunningDotNetForTheFirstTime  :  TestBase 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        private  static  CommandResult  _firstDotnetUseCommandResult ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        private  static  DirectoryInfo  _nugetCacheFolder ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        static  GivenThatTheUserIsRunningDotNetForTheFirstTime ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            var  testDirectory  =  TestAssetsManager . CreateTestDirectory ( "Dotnet_first_time_experience_tests" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            var  testNugetCache  =  Path . Combine ( testDirectory . Path ,  "nuget_cache" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            var  command  =  new  DotnetCommand ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								                . WithWorkingDirectory ( testDirectory . Path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            command . Environment [ "NUGET_PACKAGES" ]  =  testNugetCache ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _firstDotnetUseCommandResult  =  command . ExecuteWithCapturedOutput ( "new" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _nugetCacheFolder  =  new  DirectoryInfo ( testNugetCache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        }         
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        public  void  Using_dotnet_for_the_first_time_succeeds ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _firstDotnetUseCommandResult . Should ( ) . Pass ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        public  void  It_shows_the_appropriate_message_to_the_user ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            const  string  firstTimeUseWelcomeMessage  =  @ "Welcome to .NET Core!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								- - - - - - - - - - - - - - - - - - - - -  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Learn  more  about  . NET  Core  @  https : //aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Telemetry  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								- - - - - - - - - - - - - -  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								The  . NET  Core  tools  collect  usage  data  in  order  to  improve  your  experience .  The  data  is  anonymous  and  does  not  include  commandline  arguments .  The  data  is  collected  by  Microsoft  and  shared  with  the  community .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								You  can  opt  out  of  telemetry  by  setting  a  DOTNET_CLI_TELEMETRY_OPTOUT  environment  variable  to  1  using  your  favorite  shell .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								You  can  read  more  about  . NET  Core  tools  telemetry  @  https : //aka.ms/dotnet-cli-telemetry.  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								Configuring . . .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								- - - - - - - - - - - - - - - - - - -  
						 
					
						
							
								
									
										
										
										
											2016-06-10 15:06:48 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
								
									
								 
							
							
								A  command  is  running  to  initially  populate  your  local  package  cache ,  to  improve  restore  speed  and  enable  offline  access .  This  command  will  take  up  to  a  minute  to  complete  and  will  only  happen  once . ";
  
						 
					
						
							
								
									
										
										
										
											2016-06-09 20:52:49 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _firstDotnetUseCommandResult . StdOut . Should ( ) . StartWith ( firstTimeUseWelcomeMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	[Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	public  void  It_restores_the_nuget_packages_to_the_nuget_cache_folder ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	{                         
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _nugetCacheFolder . Should ( ) . HaveFile ( $"{GetDotnetVersion()}.dotnetSentinel" ) ;             
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        [Fact]  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        public  void  It_creates_a_sentinel_file_under_the_nuget_cache_folder ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								            _nugetCacheFolder . Should ( ) . HaveDirectory ( "Microsoft.NETCore.App" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	private  string  GetDotnetVersion ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    		return  new  DotnetCommand ( ) . ExecuteWithCapturedOutput ( "--version" ) . StdOut 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    			. TrimEnd ( Environment . NewLine . ToCharArray ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
									
								 
							
							
								}