public void ShouldThrowArgumentOutOfRangeException()
 {
     //Arrange
     var analyserType = "SomeOtherDriver";
     //Act & Assert
     var exception = Assert.Throws <ArgumentOutOfRangeException>(() => AnalyserLookup.GetAnalyser(analyserType));
 }
예제 #2
0
        public void ShouldThrowExceptionForEmptyInput()
        {
            // Arrange
            var analyserType = "";

            // Act and Assert
            Assert.Throws <ArgumentNullException>(() => AnalyserLookup.GetAnalyser(analyserType));
        }
예제 #3
0
        public void ShouldThrowErrorForWrongInput()
        {
            //Assign
            var analyserType = "invalid";

            //Act
            //Assert
            Assert.Throws(typeof(ArgumentOutOfRangeException), delegate { AnalyserLookup.GetAnalyser(analyserType); });
        }
        public void ShouldCreateFriendlyAnalyserInstance()
        {
            //Arrange
            var analyserType = "Friendly";
            //Act
            var analyserInstance = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.IsInstanceOf(typeof(FriendlyAnalyser), analyserInstance);
        }
        public void ShouldCreateGetawayDriverAnalyserInstance()
        {
            //Arrange
            var analyserType = "Getaway";
            //Act
            var analyserInstance = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.IsInstanceOf(typeof(GetawayDriverAnalyser), analyserInstance);
        }
        public void ShouldCreateFormulaOneDriverAnalyserInstance()
        {
            //Arrange
            var analyserType = "FormulaOne";
            //Act
            var analyserInstance = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.IsInstanceOf(typeof(FormulaOneAnalyser), analyserInstance);
        }
예제 #7
0
        public AnalyseHistoryCommand(IReadOnlyCollection <string> arguments)
        {
            var  analysisType = arguments.Count() > 1 ? arguments.First() : arguments.Single();
            bool bypass;

            bool.TryParse(arguments.ElementAt(1), out bypass); // Never mind exception here
            BypassPenlty   = bypass;
            DataSourcePath = arguments.Count() > 2 ? arguments.ElementAt(2) : string.Empty;
            _analyser      = AnalyserLookup.GetAnalyser(analysisType);
        }
예제 #8
0
        public void ShouldGetFormulaOneWithPenaltyDriverAnalyser()
        {
            //Assign
            var analyserType = "formula_one_driver_with_penalty";
            //Act
            var analyser = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.AreEqual(typeof(FormulaOneAnalyser), analyser.GetType());
        }
        public AnalyseHistoryCommand(IReadOnlyCollection <string> arguments)
        {
            //Read the first argument which is analyser type
            var analysisType = arguments.ElementAt(0);

            //Read the second argument which is name of the file from which data is to be loaded for anlysis
            _source = arguments.ElementAt(1);
            //Get appropriate analyzer instance based on type
            _analyser = AnalyserLookup.GetAnalyser(analysisType);
        }
예제 #10
0
        public void ShouldGetGetawayDriverWithPenaltyAnalyser()
        {
            //Assign
            var analyserType = "getaway_driver_with_penalty";
            //Act
            var analyser = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.AreEqual(typeof(GetawayDriverAnalyser), analyser.GetType());
        }
예제 #11
0
        public void ShouldGetDeliveryDriverAnalyser()
        {
            //Assign
            var analyserType = "delivery_driver";
            //Act
            var analyser = AnalyserLookup.GetAnalyser(analyserType);

            //Assert
            Assert.AreEqual(typeof(DeliveryDriverAnalyser), analyser.GetType());
        }
예제 #12
0
        public void ShouldReturnGetawayDriverAnalyserForValidInput()
        {
            // Arrange
            var analyserType = "getaway";

            // Act
            var analyser = AnalyserLookup.GetAnalyser(analyserType);

            // Assert
            Assert.IsInstanceOf(typeof(GetawayDriverAnalyser), analyser);
        }
예제 #13
0
        public void ShouldReturnFormulaOneDriverAnalyserForValidInput()
        {
            // Arrange
            var analyserType = "formulaone";

            // Act
            var analyser = AnalyserLookup.GetAnalyser(analyserType);

            // Assert
            Assert.IsInstanceOf(typeof(FormulaOneAnalyser), analyser);
        }
        public AnalyseHistoryCommand(IReadOnlyCollection <string> arguments)
        {
            var analysisType = arguments.ElementAt(0);

            if (arguments.Count > 1 && arguments.ElementAt(1) != null)
            {
                _drivingDataFilePath = arguments.ElementAt(1);
            }

            _analyser = AnalyserLookup.GetAnalyser(analysisType);

            if (arguments.Count > 2 && arguments.ElementAt(2) != null && arguments.ElementAt(2).ToLower() == "true")
            {
                _penalise = true;
            }
        }
예제 #15
0
        public void ShouldThrowExceptionForInvalidInput()
        {
            var analyserType = "driver";

            Assert.Throws <ArgumentException>(() => AnalyserLookup.GetAnalyser(analyserType));
        }
예제 #16
0
 public void ShouldThrowExceptionForNullInput()
 {
     Assert.Throws <ArgumentNullException>(() => AnalyserLookup.GetAnalyser(null));
 }
        public AnalyseHistoryCommand(IReadOnlyCollection <string> arguments)
        {
            var analysisType = arguments.Single();

            _analyser = AnalyserLookup.GetAnalyser(analysisType);
        }