public RegattaServiceTests() { _context = Utilities.InMemoryContextBuilder.GetContext(); _clubInitials = _context.Clubs.First().Initials; _clubId = _context.Clubs.First().Id; _regatta = _context.Regattas.First(); _mockSeriesService = new Mock <ISeriesService>(); var config = new MapperConfiguration(opts => { opts.AddProfile(new DbToModelMappingProfile()); }); _mapper = config.CreateMapper(); //yep, this means we are testing the real DbObjectBuilder as well: _dbObjectBuilder = new DbObjectBuilder( _context, _mapper ); _service = new RegattaService( _mockSeriesService.Object, _context, _dbObjectBuilder, _mapper ); }
public DbObjectBuilderTests() { _context = InMemoryContextBuilder.GetContext(); _mapper = MapperBuilder.GetSailScoresMapper(); _service = new DbObjectBuilder( _context, _mapper); }
public SeriesServiceTests() { _mockCalculator = new Mock <IScoringCalculator>(); _mockCalculator.Setup(c => c.CalculateResults(It.IsAny <Series>())).Returns(new SeriesResults { Results = new Dictionary <Competitor, SeriesCompetitorResults>() }); _mockScoringCalculatorFactory = new Mock <IScoringCalculatorFactory>(); _mockScoringCalculatorFactory.Setup(f => f.CreateScoringCalculatorAsync(It.IsAny <SailScores.Core.Model.ScoringSystem>())) .ReturnsAsync(_mockCalculator.Object); _mockScoringService = new Mock <IScoringService>(); _mockConversionService = new Mock <IConversionService>(); _context = Utilities.InMemoryContextBuilder.GetContext(); _clubInitials = _context.Clubs.First().Initials; var config = new MapperConfiguration(opts => { opts.AddProfile(new DbToModelMappingProfile()); }); _mapper = config.CreateMapper(); _fakeSeries = _mapper.Map <Series>(_context.Series.First()); _seriesUrlName = _fakeSeries.UrlName; //yep, this means we are testing the real DbObjectBuilder as well: _dbObjectBuilder = new DbObjectBuilder( _context, _mapper ); _service = new SailScores.Core.Services.SeriesService( _mockScoringCalculatorFactory.Object, _mockScoringService.Object, _mockConversionService.Object, _dbObjectBuilder, _context, _mapper ); }