/// <summary>
        /// ラベル色
        /// </summary>
        /// <param name="readStatus">読み込み経過状態</param>
        /// <param name="commonEvent">結果格納インスタンス</param>
        private void ReadLabelColor(BinaryReadStatus readStatus, CommonEvent commonEvent)
        {
            var colorNumber = readStatus.ReadInt();

            readStatus.IncreaseIntOffset();

            commonEvent.LabelColor = CommonEventLabelColor.FromInt(colorNumber);
        }
        /// <summary>
        /// ラベル色
        /// </summary>
        /// <param name="status">読み込み経過状態</param>
        /// <param name="commonEvent">結果格納インスタンス</param>
        private void ReadLabelColor(FileReadStatus status, CommonEvent commonEvent)
        {
            var colorNumber = status.ReadInt();

            status.IncreaseIntOffset();

            commonEvent.LabelColor = CommonEventLabelColor.FromInt(colorNumber);

            Logger.Debug(FileIOMessage.SuccessRead(typeof(CommonEventReader),
                                                   "ラベル色", commonEvent.LabelColor));
        }
Exemple #3
0
        public static void LabelColorTest(CommonEventLabelColor color, bool isError)
        {
            var instance            = new CommonEvent();
            var changedPropertyList = new List <string>();

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

            var errorOccured = false;

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

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

            if (!errorOccured)
            {
                var setValue = instance.LabelColor;

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

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