public static void SetReturnVariableIndexTest(int commonVariableIndex, bool isReturnFlag) { var instance = new CommonEventReturnValue(); var changedPropertyList = new List <string>(); instance.PropertyChanged += (sender, args) => { changedPropertyList.Add(args.PropertyName); }; var index = (CommonEventReturnVariableIndex)commonVariableIndex; var errorOccured = false; try { instance.SetReturnVariableIndex(index); } catch (Exception ex) { logger.Exception(ex); errorOccured = true; } // エラーが発生しないこと Assert.IsFalse(errorOccured); // 返戻値フラグが一致すること Assert.AreEqual(instance.IsReturnValue, isReturnFlag); // 意図したとおりプロパティ変更通知が発火していること Assert.AreEqual(changedPropertyList.Count, 2); Assert.IsTrue(changedPropertyList[0].Equals(nameof(CommonEventReturnValue.ReturnVariableIndex))); Assert.IsTrue(changedPropertyList[1].Equals(nameof(CommonEventReturnValue.IsReturnValue))); }