public void InstanceDataAttribute_succeeds_for_parameterless_method( ) { var method = ParameterlessMethod( ); var attribute = new InstanceDataAttribute( ); var data = attribute.GetData(method); var item = Assert.Single(data); Assert.Empty(item); }
public void InstanceDataAttribute_succeeds_for_parameterized_method( ) { var method = ParameterizedMethod(0); var parameterTypes = GetParameterTypes(method); var attribute = new InstanceDataAttribute( ); var data = attribute.GetData(method); var item = Assert.Single(data); var argument = Assert.Single(item); Assert.Equal(parameterTypes[0], argument.GetType( )); }
public void InstanceDataAttribute_succeeds_for_method_requiring_STA_thread(ApartmentState apartmentState) { var method = StaTestMethod(null); var parameterTypes = GetParameterTypes(method); object[][] data = null; var thread = new Thread(() => { var attribute = new InstanceDataAttribute( ); data = attribute.GetData(method).ToArray( ); }) { IsBackground = true }; thread.SetApartmentState(apartmentState); thread.Start( ); thread.Join( ); var item = Assert.Single(data); var argument = Assert.Single(item); Assert.Equal(parameterTypes[0], argument.GetType( )); }