Exemple #1
0
        public void IsSatisfiedBy_NoOperator_False()
        {
            // Arrange
            var alertCriteria = new AlertCriteria();
            var spec          = new PriceSpecification(alertCriteria);
            var message       = new AlertEvaluationMessage();

            // Act
            var result = spec.IsSatisfiedBy(message);

            // Assert
            result.Should().BeFalse();
        }
Exemple #2
0
        public void IsSatisfiedBy_LessThanOrEqual_LastPriceEqualLevel_PrevLastPriceGreaterThanLevel_True()
        {
            // Arrange
            var alertCriteria = new AlertCriteria {
                Operator = CriteriaOperator.LessThanOrEqualTo, Level = 50
            };
            var spec    = new PriceSpecification(alertCriteria);
            var message = new AlertEvaluationMessage {
                LastPrice = 50, PreviousLastPrice = 50.1M
            };

            // Act
            var result = spec.IsSatisfiedBy(message);

            // Assert
            result.Should().BeTrue();
        }
Exemple #3
0
        public void IsSatisfiedBy_EqualTo_LastPriceLessThanLevel_PrevLastPriceEqualLevel_False()
        {
            // Arrange
            var alertCriteria = new AlertCriteria {
                Operator = CriteriaOperator.Equals, Level = 50
            };
            var spec    = new PriceSpecification(alertCriteria);
            var message = new AlertEvaluationMessage {
                LastPrice = 49, PreviousLastPrice = 50
            };

            // Act
            var result = spec.IsSatisfiedBy(message);

            // Assert
            result.Should().BeFalse();
        }