public void ReturnTrueWhenAllRulePass()
        {
            //Arrange
            var mockRule1 = new Mock <IRule>();

            mockRule1.Setup(r => r.IsMatched(It.IsAny <Event>())).Returns(true);

            var mockRule2 = new Mock <IRule>();

            mockRule2.Setup(r => r.IsMatched(It.IsAny <Event>())).Returns(true);

            List <IRule> rules = new List <IRule> {
                mockRule1.Object, mockRule2.Object
            };

            FlightValidator validator = new FlightValidator(rules);

            var fixture = new Fixture();

            var flightEvent = fixture.Build <Event>().Create();

            //Act
            var result = validator.IsValidate(flightEvent);

            //Assert
            Assert.True(result);
        }
Esempio n. 2
0
        public void Setup()
        {
            _uut      = new FlightValidator();
            _airspace = Substitute.For <IAirspace>();

            _airspace.Height = 80000;
            _airspace.Width  = 80000;
            _airspace.MaxAlt = 20000;
            _airspace.MinAlt = 500;
        }
Esempio n. 3
0
        public void Setup()
        {
            //Ceating fake
            _fakeFlightHandler = Substitute.For <IFlightHandler>();

            _uut = Substitute.For <FlightValidator>();

            _validFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 20000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 500)
                }
            };

            _oneInvalidFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 25000) // Invalid, z too high
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 500)
                }
            };

            _twoInvalidFlights = new List <Flight>()
            {
                new Flight()
                {
                    position = new Coords(16000, 16000, 5000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 25000)
                },
                new Flight()
                {
                    position = new Coords(8000, 8000, 400) // Invalid, z too low
                }
            };
        }
 public FlightService(IUnitOfWork unitOfWork, IMapper mapper)
 {
     this.unitOfWork = unitOfWork;
     this.mapper     = mapper;
     validator       = new FlightValidator();
 }