public void NameOf_OneGenericArgument_LocalVariablesOrArguments( [Values("whatever")] string argument) { var local = new StaticReflectionSubjectType(); Assert.That(Name.Of(() => local), Is.EqualTo("local")); Assert.That(Name.Of(() => argument), Is.EqualTo("argument")); }
public void ValueOf_LocalVariablesOrArguments( [Values("whatever")] string argument) { var local = new StaticReflectionSubjectType(); Assert.That(Value.Of(() => local), Is.InstanceOf <StaticReflectionSubjectType>()); Assert.That(Value.Of(() => argument), Is.EqualTo("whatever")); }
public void NameOf_OneGenericArgument_InstancePropertiesOrFields_GetsTheName() { var instance = new StaticReflectionSubjectType(); Assert.That(Name.Of(() => instance.ComplexProperty), Is.EqualTo("ComplexProperty")); Assert.That(Name.Of(() => ComplexProperty), Is.EqualTo("ComplexProperty")); Assert.That(Name.Of(() => instance.SimpleField), Is.EqualTo("SimpleField")); Assert.That(Name.Of(() => _simpleField), Is.EqualTo("_simpleField")); Assert.That(Name.Of(() => instance.ComplexField), Is.EqualTo("ComplexField")); Assert.That(Name.Of(() => _complexField), Is.EqualTo("_complexField")); Assert.That(Name.Of(() => Event), Is.EqualTo("Event")); }
public void ValueOf_InstancePropertiesOrFields_GetsTheName() { var instance = new StaticReflectionSubjectType { ComplexProperty = new StaticReflectionSubjectType2() }; ComplexProperty = new StaticReflectionSubjectType(); instance.ComplexField = new StaticReflectionSubjectType2(); Event += (_, __) => { }; Assert.That(Value.Of(() => instance.ComplexProperty), Is.InstanceOf <StaticReflectionSubjectType2>()); Assert.That(Value.Of(() => ComplexProperty), Is.InstanceOf <StaticReflectionSubjectType>()); Assert.That(Value.Of(() => instance.SimpleField), Is.EqualTo(0)); Assert.That(Value.Of(() => _simpleField), Is.EqualTo(3)); Assert.That(Value.Of(() => instance.ComplexField), Is.InstanceOf <StaticReflectionSubjectType2>()); Assert.That(Value.Of(() => _complexField), Is.InstanceOf <StaticReflectionSubjectType>()); Assert.That(Value.Of(() => Event), Is.Not.Null); }