示例#1
0
        /// <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));
        }
示例#2
0
        /// <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));
        }
示例#3
0
        /// <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));
        }
示例#4
0
        /// <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));
        }
示例#5
0
 public void IsOfTypeThrowsOnNotSubtypeValueTypeTest()
 {
     Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <float, int>());
 }
示例#6
0
 public void IsOfTypeThrowsOnNotSubtypeSystemTest()
 {
     Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <object, string>());
 }
示例#7
0
        public void IsOfTypeSystemTest()
        {
            var exception = Record.Exception(() => Precondition.IsOfType <string, object>());

            Assert.Null(exception);
        }
示例#8
0
 public void IsOfTypeThrowsOnNotSubtypeTest()
 {
     Assert.Throws <InvalidCastException>(() => Precondition.IsOfType <BaseType, DerivedType>());
 }
示例#9
0
        public void IsOfTypeTest()
        {
            var exception = Record.Exception(() => Precondition.IsOfType <DerivedType, BaseType>());

            Assert.Null(exception);
        }