예제 #1
0
        public override CompanyValueStatus PredictValue(CompanyValueStatus historical)
        {
            Historical = historical;

            CalculatePriceAndDateSteps();
            var generatedValues = GenerateCollectionToReturn();

            return(new CompanyValueStatus(historical.Company, generatedValues));
        }
예제 #2
0
        public async Task predict_values_calls_map_method_on_mapper_using_value_predictor_result()
        {
            //Given
            string algorithm = "algorithm";

            var company               = new Company("AAPL", "Apple Inc.", 50m);
            var companyValues         = new List <CompanyValue>();
            var historicalValueStatus = new CompanyValueStatus(company, companyValues);
            var predictedValueStatus  = new CompanyValueStatus(company, companyValues);

            var companyRepoMock = new Mock <ICompanyRepository>();

            companyRepoMock.Setup(x => x.GetCompanyValueStatusAsync(company.Symbol))
            .ReturnsAsync(historicalValueStatus);

            var mapperMock = new Mock <IMapper>();

            var predictorMock = new Mock <IValuePredictor>();

            predictorMock.Setup(x => x.PredictValue(historicalValueStatus))
            .Returns(predictedValueStatus);

            var predictorProviderMock = new Mock <IValuePredictorProvider>();

            predictorProviderMock.Setup(x => x.GetPredictor(algorithm))
            .Returns(predictorMock.Object);

            var comapnyService = new CompanyService(companyRepoMock.Object,
                                                    predictorProviderMock.Object, mapperMock.Object);

            //When
            await comapnyService.PredictValues(company.Symbol, algorithm);

            //Then
            mapperMock.Verify(x => x.Map <CompanyValueStatusDto>(predictedValueStatus),
                              Times.Once);
        }
 public abstract CompanyValueStatus PredictValue(CompanyValueStatus historical);
예제 #4
0
 public CompanyValueStatus PredictValue(CompanyValueStatus historical)
 {
     throw new System.NotImplementedException();
 }