public void 필드래퍼는_옵저버를추가할때_조건함수를_붙일수있습니다() { // Arrange (데이터 정렬) int iTestValue = 3; FieldWrapper <int> pFieldWrapper_Int = new FieldWrapper <int>(iTestValue); pFieldWrapper_Int.DoAddObserver_WithCondition(값이_5이상일때, 알람을_받았다_1); iListenCount = 0; // Act (기능 실행) pFieldWrapper_Int.Value += 1; // Assert (맞는지 체크) Assert.AreEqual(pFieldWrapper_Int.Value, 4); Assert.AreEqual(iListenCount, 0); // Act (기능 실행) pFieldWrapper_Int.Value += 1; // Assert (맞는지 체크) Assert.AreEqual(pFieldWrapper_Int.Value, 5); Assert.AreEqual(iListenCount, 1); }
public void 필드래퍼는_한번만알림기능을_지원합니다() { // Arrange (데이터 정렬) int iTestValue = 3; FieldWrapper <int> pFieldWrapper_Int = new FieldWrapper <int>(iTestValue); pFieldWrapper_Int.DoAddObserver_WithCondition(값이_5이상일때, 알람을_받았다_1, true); iListenCount = 0; // Act (기능 실행) pFieldWrapper_Int.Value += 1; // Assert (맞는지 체크) Assert.AreEqual(iListenCount, 0); Assert.AreEqual(pFieldWrapper_Int.iObserverCount, 1); // Act (기능 실행) pFieldWrapper_Int.Value += 1; // Assert (맞는지 체크) Assert.AreEqual(iListenCount, 1); Assert.AreEqual(pFieldWrapper_Int.iObserverCount, 0); }