/// <summary> /// Converts a shim into the class is corresponds to. /// </summary> /// <typeparam name="TargetType">The type to convert this shim to.</typeparam> /// <returns>An instance of a child class of <see cref="ParquetParent"/>.</returns> public override TargetType To <TargetType>() { Precondition.IsOfType <TargetType, Furnishing>(typeof(TargetType).ToString()); return((TargetType)(ParquetParent) new Furnishing(ID, Name, Description, Comment, ItemID, AddsToBiome, AddsToBiome, IsWalkable, IsEntry, IsEnclosing, SwapID)); }
/// <summary> /// Converts a shim into the class is corresponds to. /// </summary> /// <typeparam name="TargetType">The type to convert this shim to.</typeparam> /// <returns>An instance of a child class of <see cref="ParquetParent"/>.</returns> public override TargetType To <TargetType>() { Precondition.IsOfType <TargetType, Collectible>(typeof(TargetType).ToString()); return((TargetType)(ParquetParent) new Collectible(ID, Name, Description, Comment, ItemID, AddsToBiome, AddsToRoom, Effect, EffectAmount)); }
/// <summary> /// Converts a shim into the class is corresponds to. /// </summary> /// <typeparam name="TargetType">The type to convert this shim to.</typeparam> /// <returns>An instance of a child class of <see cref="ParquetParent"/>.</returns> public override TargetType To <TargetType>() { Precondition.IsOfType <TargetType, Floor>(typeof(TargetType).ToString()); return((TargetType)(ParquetParent) new Floor(ID, Name, Description, Comment, ItemID, AddsToBiome, AddsToRoom, ModTool, TrenchName, IsWalkable)); }
/// <summary> /// Converts a shim into the class is corresponds to. /// </summary> /// <typeparam name="TargetType">The type to convert this shim to.</typeparam> /// <returns> /// An instance of a child class of <see cref="ParquetParent"/>. /// </returns> public override TargetType To <TargetType>() { Precondition.IsOfType <TargetType, Block>(typeof(TargetType).ToString()); return((TargetType)(ParquetParent) new Block(ID, Name, Description, Comment, ItemID, AddsToBiome, AddsToRoom, GatherTool, GatherEffect, CollectibleID, IsFlammable, IsLiquid, MaxToughness)); }
public void IsOfTypeThrowsOnNotSubtypeValueTypeTest() { Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <float, int>()); }
public void IsOfTypeThrowsOnNotSubtypeSystemTest() { Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <object, string>()); }
public void IsOfTypeSystemTest() { var exception = Record.Exception(() => Precondition.IsOfType <string, object>()); Assert.Null(exception); }
public void IsOfTypeThrowsOnNotSubtypeTest() { Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <BaseType, DerivedType>()); }
public void IsOfTypeTest() { var exception = Record.Exception(() => Precondition.IsOfType <DerivedType, BaseType>()); Assert.Null(exception); }