Esempio n. 1
0
        /// <summary>
        /// 起動条件比較演算子 &amp; 起動条件
        /// </summary>
        /// <param name="readStatus">読み込み経過状態</param>
        /// <param name="condition">結果格納インスタンス</param>
        private void ReadBootConditionOperationAndType(BinaryReadStatus readStatus,
                                                       CommonEventBootCondition condition)
        {
            var b = readStatus.ReadByte();

            readStatus.IncreaseByteOffset();
            condition.Operation           = CriteriaOperator.FromByte((byte)(b & 0xF0));
            condition.CommonEventBootType = CommonEventBootType.FromByte((byte)(b & 0x0F));
        }
Esempio n. 2
0
        /// <summary>
        /// 起動条件比較演算子 &amp; 起動条件
        /// </summary>
        /// <param name="status">読み込み経過状態</param>
        /// <param name="condition">結果格納インスタンス</param>
        private void ReadBootConditionOperationAndType(FileReadStatus status,
                                                       CommonEventBootCondition condition)
        {
            var b = status.ReadByte();

            status.IncreaseByteOffset();
            condition.Operation           = CriteriaOperator.FromByte((byte)(b & 0xF0));
            condition.CommonEventBootType = CommonEventBootType.FromByte((byte)(b & 0x0F));

            Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader),
                                                   "起動条件比較演算子", condition.Operation));
            Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader),
                                                   "起動条件", condition.CommonEventBootType));
        }
        public static void CommonEventBootTypeTest(CommonEventBootType type, bool isError)
        {
            var instance            = new CommonEventBootCondition();
            var changedPropertyList = new List <string>();

            instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); };

            var errorOccured = false;

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

            // エラーフラグが一致すること
            Assert.AreEqual(errorOccured, isError);

            if (!errorOccured)
            {
                var getValue = instance.CommonEventBootType;

                // セットした値と取得した値が一致すること
                Assert.IsTrue(getValue == type);
            }

            // 意図したとおりプロパティ変更通知が発火していること
            if (errorOccured)
            {
                Assert.AreEqual(changedPropertyList.Count, 0);
            }
            else
            {
                Assert.AreEqual(changedPropertyList.Count, 1);
                Assert.IsTrue(changedPropertyList[0].Equals(nameof(CommonEventBootCondition.CommonEventBootType)));
            }
        }