public void GetTyped() { Assert.Equal(5, ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5).Get <int>(0)); Assert.Equal(5, ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5).Get <int>("value")); // If nullable annotations are ignored and we request a nullable int, it should still work. #nullable disable
public void AccessValueByName() { var arguments = ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5); Assert.Equal(5, arguments.GetValue("value")); arguments.SetValue("value", 10); Assert.Equal(10, arguments.Get <int>("value")); }
public void Count() #pragma warning disable xUnit2013 // Do not use equality check to check for collection size. => Assert.Equal(1, ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5).Count);
public void AccessValueByIndex() { var arguments = ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5); Assert.Equal(5, arguments.GetValue(0)); }
public void ThrowsIfSetValueIndexNotFound() => Assert.Throws <IndexOutOfRangeException>(() => ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5).SetValue(42, 42));
public void ThrowsIfSetValueNameNotFound() => Assert.Throws <KeyNotFoundException>(() => ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5).SetValue("foo", 42));
public void ThrowsIfMismatchValuesLength() => Assert.Throws <TargetParameterCountException>(() => ArgumentCollection.Create(valueTypeMethod.GetParameters(), 5, "Foo"));