本文整理汇总了C#中TestState.HasComponent方法的典型用法代码示例。如果您正苦于以下问题:C# TestState.HasComponent方法的具体用法?C# TestState.HasComponent怎么用?C# TestState.HasComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestState
的用法示例。
在下文中一共展示了TestState.HasComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldAddComponentToGameState
public void ShouldAddComponentToGameState()
{
var state = new TestState();
Assert.False(state.HasComponent(typeof (FooComponent)));
var comp = state.AddComponent(new FooComponent());
Assert.True(state.HasComponent(comp));
}
示例2: ShouldHaveComponentOfType
public void ShouldHaveComponentOfType()
{
var state = new TestState();
var fooComp = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(typeof(FooComponent)));
Assert.False(state.HasComponent(typeof(BarComponent)));
}
示例3: ShouldHaveComponentMatchingPredicate
public void ShouldHaveComponentMatchingPredicate()
{
var state = new TestState();
var fooComp = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(c => ((FooComponent)c).Test == "Foo"));
Assert.False(state.HasComponent(c => ((FooComponent)c).Test == "Bar"));
}
示例4: ShouldOnlyHaveExactReferenceToComponent
public void ShouldOnlyHaveExactReferenceToComponent()
{
var state = new TestState();
var fooComp = new FooComponent();
var fooComp2 = new FooComponent();
state.AddComponent(fooComp);
Assert.True(state.HasComponent(fooComp));
Assert.False(state.HasComponent(fooComp2));
}