Esempio n. 1
0
        public void get_predictor_throws_exception_if_given_collection_in_constructor_does_not_contain_any_matching_predictor()
        {
            //Given
            string id      = "id";
            string otherId = "other";

            IEnumerable <IValuePredictor> predictors = new List <IValuePredictor>
            {
                new ValuePredictorMock(id),
            };

            var provider = new ValuePredictorProvider(predictors);

            //When
            void act() => provider.GetPredictor(otherId);

            //Then
            Assert.Throws <WrongAlgorithmNameSerExc>(act);
        }
Esempio n. 2
0
        public void get_predictor_throws_exception_if_given_collection_in_constructor_does_not_return_single_or_default_on_filtering_by_given_id()
        {
            //Given
            string id = "id";

            IEnumerable <IValuePredictor> predictors = new List <IValuePredictor>
            {
                new ValuePredictorMock(id),
                new ValuePredictorMock(id)
            };

            var provider = new ValuePredictorProvider(predictors);

            //When
            void act() => provider.GetPredictor(id);

            //Then
            Assert.Throws <InvalidOperationException>(act);
        }
Esempio n. 3
0
        public void get_predictor_returns_matching_predictor_if_exists_in_given_collection()
        {
            //Given
            string id                = "id";
            string otherId           = "other";
            var    matchingPredictor = new ValuePredictorMock(id);

            IEnumerable <IValuePredictor> predictors = new List <IValuePredictor>
            {
                matchingPredictor,
                new ValuePredictorMock(otherId)
            };

            var provider = new ValuePredictorProvider(predictors);

            //When
            var result = provider.GetPredictor(id);

            //Then
            result.Should().BeSameAs(matchingPredictor);
        }