public void CanTryGetExistingValueWithCorrectType() { // Arrange var parameters = new ParameterView(ParameterViewLifetime.Unbound, new[] { RenderTreeFrame.Element(0, "some element").WithElementSubtreeLength(2), RenderTreeFrame.Attribute(1, "my entry", "hello") }, 0); // Act var didFind = parameters.TryGetValue <string>("my entry", out var value); // Assert Assert.True(didFind); Assert.Equal("hello", value); }
public void CanTryGetNonExistingValue() { // Arrange var parameters = new ParameterView(ParameterViewLifetime.Unbound, new[] { RenderTreeFrame.Element(0, "some element").WithElementSubtreeLength(2), RenderTreeFrame.Attribute(1, "some other entry", new object()) }, 0); // Act var didFind = parameters.TryGetValue <string>("nonexisting entry", out var value); // Assert Assert.False(didFind); Assert.Null(value); }