public void SetSymPath_For_CurrentUser_Should_Return_Already_Exists() { //arrange SymPath symPath = new SymPath(mock_environmentVariable.Object, mock_Logger.Object); mock_environmentVariable.Setup(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.User)).Returns(NT_SYMBOL_PATH); //act symPath.SetSymPath(); //assert mock_environmentVariable.Verify(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.User), Times.Once); mock_environmentVariable.Verify(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.Machine), Times.Never); mock_environmentVariable.Verify(e => e.SetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, NT_SYMBOL_PATH), Times.Never); }
public void SetSymPath_Should_Return_Successful() { //arrange SymPath symPath = new SymPath(mock_environmentVariable.Object, mock_Logger.Object); mock_environmentVariable.Setup(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.User)).Returns(String.Empty); mock_environmentVariable.Setup(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.Machine)).Returns(String.Empty); //act symPath.SetSymPath(); //assert mock_environmentVariable.Verify(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.User), Times.Once); mock_environmentVariable.Verify(e => e.GetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, EnvironmentVariableTarget.Machine), Times.Once); mock_environmentVariable.Verify(e => e.SetEnvironmentVariable(NT_SYMBOL_VARIABLE_NAME, NT_SYMBOL_PATH), Times.Once); }