Ejemplo n.º 1
0
        public static void ToIntTest(int value)
        {
            var instance = new CommonEventVariableIndex(value);

            var intValue = instance.ToInt();

            // セットした値と取得した値が一致すること
            Assert.AreEqual(intValue, value);
        }
        /// <summary>
        /// コモンイベントIDとインデックスからコモンイベントセルフ変数名を取得する。
        /// </summary>
        /// <param name="commonEventId">コモンイベントID</param>
        /// <param name="index">インデックス</param>
        /// <returns>コモンイベントセルフ変数名(存在しないコモンイベントの場合空文字)</returns>
        public CommonEventSelfVariableName GetCommonEventSelfVariableName(
            CommonEventId commonEventId, CommonEventVariableIndex index)
        {
            if (Master.CommonEventList.Count <= commonEventId)
            {
                return(string.Empty);
            }
            var commonEvent = Master.CommonEventList[commonEventId];

            return(commonEvent.SelfVariableNameList[index]);
        }
Ejemplo n.º 3
0
        public static void ConstructorIntTest(int value, bool isError)
        {
            var errorOccured = false;

            try
            {
                var _ = new CommonEventVariableIndex(value);
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーフラグが一致すること
            Assert.AreEqual(errorOccured, isError);
        }
Ejemplo n.º 4
0
        public static void CastCommonEventVariableIndexToIntTest(int value)
        {
            var castValue = 0;

            var instance = new CommonEventVariableIndex(value);

            var errorOccured = false;

            try
            {
                castValue = instance;
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生しないこと
            Assert.IsFalse(errorOccured);

            // 元の値と一致すること
            Assert.AreEqual(castValue, value);
        }