本文整理汇总了C#中PropertyHolder.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyHolder.GetType方法的具体用法?C# PropertyHolder.GetType怎么用?C# PropertyHolder.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyHolder
的用法示例。
在下文中一共展示了PropertyHolder.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SutIsGuardClauseCommand
public void SutIsGuardClauseCommand()
{
// Fixture setup
var dummyOwner = new PropertyHolder<object>();
var dummyProperty = dummyOwner.GetType().GetProperty("Property");
// Exercise system
var sut = new PropertySetCommand(dummyProperty, dummyOwner);
// Verify outcome
Assert.IsAssignableFrom<IGuardClauseCommand>(sut);
// Teardown
}
示例2: RequestedTypeIsCorrect
public void RequestedTypeIsCorrect()
{
// Fixture setup
var dummyOwner = new PropertyHolder<Version>();
var property = dummyOwner.GetType().GetProperty("Property");
var sut = new PropertySetCommand(property, dummyOwner);
// Exercise system
var result = sut.RequestedType;
// Verify outcome
Assert.Equal(property.PropertyType, result);
// Teardown
}
示例3: OwnerIsCorrect
public void OwnerIsCorrect()
{
// Fixture setup
var owner = new PropertyHolder<object>();
var dummyProperty = owner.GetType().GetProperty("Property");
var sut = new PropertySetCommand(dummyProperty, owner);
// Exercise system
var result = sut.Owner;
// Verify outcome
Assert.Equal(owner, result);
// Teardown
}
示例4: PropertyInfoIsCorrect
public void PropertyInfoIsCorrect()
{
// Fixture setup
var dummyOwner = new PropertyHolder<object>();
var propertyInfo = dummyOwner.GetType().GetProperty("Property");
var sut = new PropertySetCommand(propertyInfo, dummyOwner);
// Exercise system
PropertyInfo result = sut.PropertyInfo;
// Verify outcome
Assert.Equal(propertyInfo, result);
// Teardown
}
示例5: ExecuteAssignsValueToOwnerProperty
public void ExecuteAssignsValueToOwnerProperty()
{
// Fixture setup
var owner = new PropertyHolder<object>();
var property = owner.GetType().GetProperty("Property");
var sut = new PropertySetCommand(property, owner);
var value = new object();
// Exercise system
sut.Execute(value);
// Verify outcome
Assert.Equal(value, owner.Property);
// Teardown
}
示例6: CreateExceptionReturnsExceptionWithCorrectMessage
public void CreateExceptionReturnsExceptionWithCorrectMessage()
{
// Fixture setup
var dummyOwner = new PropertyHolder<Version>();
var dummyProperty = dummyOwner.GetType().GetProperty("Property");
var sut = new PropertySetCommand(dummyProperty, dummyOwner);
// Exercise system
var message = Guid.NewGuid().ToString();
var result = sut.CreateException(message);
// Verify outcome
var e = Assert.IsAssignableFrom<GuardClauseException>(result);
Assert.Contains(message, e.Message);
// Teardown
}
示例7: ExecuteOnNonGenericWillAssignProperty
public void ExecuteOnNonGenericWillAssignProperty()
{
// Fixture setup
var specimen = new PropertyHolder<object>();
var sut = new AutoPropertiesCommand(specimen.GetType());
var expectedPropertyValue = new object();
var container = new DelegatingSpecimenContext { OnResolve = r => expectedPropertyValue };
// Exercise system
sut.Execute(specimen, container);
// Verify outcome
Assert.Equal(expectedPropertyValue, specimen.Property);
// Teardown
}