예제 #1
0
        public void ManipulateState_InvalidCast_IsIgnored()
        {
            // Arrange
            var condition = new RatingCondition <int>(0, i => i > 10);

            // Act
            condition.ManipulateState("test");

            // Assert
            Assert.Equal(0, condition.CurrentState);
        }
예제 #2
0
        public void ManipulateState_Cast_IsSuccessful()
        {
            // Arrange
            var condition = new RatingCondition <int>(0, i => i > 10);

            // Act
            condition.ManipulateState(3);

            // Assert
            Assert.Equal(3, condition.CurrentState);
        }
예제 #3
0
        public void Reset_IsEpxpectedValue(int initial)
        {
            // Arrange
            var condition = new RatingCondition <int>(initial, i => i > 10);

            // Act
            condition.ManipulateState(5);
            condition.Reset();

            // Assert
            Assert.Equal(initial, condition.CurrentState);
        }
예제 #4
0
        public void ToConditionCacheDto_Returns_ExpectedResult()
        {
            // Arrange
            var condition = new RatingCondition <int>(0, i => i > 3);

            condition.ManipulateState(5);

            // Act
            var dto = condition.ToConditionCacheDto("test");

            // Assert
            Assert.NotNull(dto);
            Assert.Equal("test", dto.ConditionName);
            Assert.Equal(5, dto.CurrentValue);
        }