Exemplo n.º 1
0
        public static void GetAllCommonEventTest(int commonEventLength)
        {
            var instance = new CommonFileData();

            instance.SetCommonEventList(MakeCommonEventList(commonEventLength));
            var changedPropertyList = new List <string>();

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

            var errorOccured = false;

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

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

            // 取得件数が意図した値と一致すること
            var eventsLength = instance.GetAllCommonEvent().Count();

            Assert.AreEqual(eventsLength, commonEventLength);

            // プロパティ変更通知が発火していないこと
            Assert.AreEqual(changedPropertyList.Count, 0);
        }