public void ReplacePlainTextVariablesIn_should_replace_all_variables() { // given var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, new VariableEncryptorStub()); sessionVariables.AddOrUpdateVariable(new Variable("nano", "leaf", _devEnvironment)); sessionVariables.AddOrUpdateVariable(new Variable("two", "ten", _devEnvironment)); string template = "{nano} {dummy} {two}"; string expectedText = "leaf {dummy} ten"; // when string actualText = sessionVariables.ReplacePlainTextVariablesIn(template); // then Assert.That(actualText, Is.EqualTo(expectedText)); }
public void ReplacePlainTextVariablesIn_should_call_decrypt() { // given string variableValue = "leaf"; var mock = new Mock <IVariableEncryptor>(); mock.Setup(x => x.Decrypt(It.IsAny <string>())) .Returns(variableValue) .Verifiable("decrypt not called"); var sessionVariables = new CapturedVariableProvider(_variableContainer, _devEnvironment, mock.Object); sessionVariables.AddOrUpdateVariable(new Variable("nano", variableValue, _devEnvironment)); string template = "{nano}"; // when string actualText = sessionVariables.ReplacePlainTextVariablesIn(template); // then mock.Verify(x => x.Decrypt(variableValue)); }