public void DeclareVariableWithErrorRemoteValue() { RemoteValueFake remoteValue = RemoteValueFakeUtil.CreateClass("MyType", "myType", "myValue"); remoteValue.AddValueFromExpression($"auto $test=5; $test", RemoteValueFakeUtil.CreateError("declaration error")); var natvisScope = new NatvisScope(); natvisScope.AddScopedName("test", "$test"); IVariableInformation varInfo = _varInfoFactory.Create(remoteValue); var exception = Assert.ThrowsAsync <ExpressionEvaluationFailed>( async() => await _evaluator.DeclareVariableAsync(varInfo, "test", "5", natvisScope)); Assert.That(exception.Message, Does.Contain("test")); Assert.That(exception.Message, Does.Contain("5")); Assert.That(exception.Message, Does.Contain("declaration error")); string logOutput = _nLogSpy.GetOutput(); Assert.That(logOutput, Does.Contain("test")); Assert.That(logOutput, Does.Contain("5")); Assert.That(logOutput, Does.Contain("declaration error")); }
public void ErrorWhenSbValueHasError() { var remoteValue = RemoteValueFakeUtil.CreateError("Oh no!"); var varInfo = CreateVarInfo(remoteValue, "remoteValue"); Assert.That(varInfo.Error, Is.True); Assert.That(varInfo.ErrorMessage, Is.EqualTo("Oh no!")); }
public void EvaluateExpressionWithErrorRemoteValue() { RemoteValueFake remoteValue = RemoteValueFakeUtil.CreatePointer("MyType*", "myType", _memAddress); remoteValue.AddValueFromExpression("myVal", RemoteValueFakeUtil.CreateError("invalid expression")); IVariableInformation varInfo = _varInfoFactory.Create(remoteValue); var exception = Assert.ThrowsAsync <ExpressionEvaluationFailed>( async() => await _evaluator.EvaluateExpressionAsync( "myVal", varInfo, new NatvisScope(), "tmp")); Assert.That(exception.Message, Does.Contain("myVal")); }