示例#1
0
        public static void UpdateDatabaseSpecialCaseTest()
        {
            var instance = new CommonEventSpecialNumberArgDesc.InnerDescNormal();
            var changedDescPropertyList = new List <string>();

            instance.PropertyChanged += (sender, args) => { changedDescPropertyList.Add(args.PropertyName); };
            var changedSpecialArgCaseListPropertyList = new List <string>();

            instance.SpecialArgCaseList.PropertyChanged += (sender, args) =>
            {
                changedSpecialArgCaseListPropertyList.Add(args.PropertyName);
            };
            var changedSpecialArgCaseListCollectionArgList = new List <NotifyCollectionChangedEventArgs>();

            instance.SpecialArgCaseList.CollectionChanged += (sender, args) =>
            {
                changedSpecialArgCaseListCollectionArgList.Add(args);
            };

            var errorOccured = false;

            try
            {
                instance.UpdateDatabaseSpecialCase(0, "");
            }
            catch (Exception ex)
            {
                logger.Exception(ex);
                errorOccured = true;
            }

            // エラーが発生すること
            Assert.IsTrue(errorOccured);

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