Mocks.EnvironmentMock.SetVariable C# (CSharp) Method

SetVariable() public method

public SetVariable ( string variable, string value ) : void
variable string
value string
return void
		public void SetVariable (string variable, string value)
		{
			mock.Setup (m => m.GetEnvironmentVariable (variable)).Returns (value);
		}
	}

Usage Example

Example #1
0
		// Analysis disable once InconsistentNaming
		public void GetUserCacheDir_ReturnsXdgCacheHome_WhenXdgCacheHomeAndHomeAreSet ()
		{
			var environment = new EnvironmentMock ("XDG_CACHE_HOME", "/path/to/.cache");
			environment.SetVariable ("HOME", "/home/user");
			var xdg = new XdgDirectoryService (null, environment.Object);

			var result = xdg.GetUserCacheDir ();

			Assert.AreEqual ("/path/to/.cache", result);
		}
All Usage Examples Of Mocks.EnvironmentMock::SetVariable