public GuestAccountStatisticsCollector(ILifetimeScope scope, GuestAccountInfo guestAccountInfo, long accountId) { _accountId = accountId; (_scope, OperationsCount) = CreateOperationSteps(scope); _guestAccountInfo = guestAccountInfo; }
public async Task <GuestAccountInfo> ReadAccountInfoAndPutInCache(long accountId) { var guestAccountInfo = new GuestAccountInfo(); await _statisticsCollectorEngine.Collect( _statisticsCollectorFactory.CreateCollector(accountId, guestAccountInfo)); string cacheKey = string.Format(CacheKeyTemplate, accountId); _cache.Set <GuestAccountInfo>(cacheKey, guestAccountInfo, TimeSpan.FromMinutes(10)); return(guestAccountInfo); }
public async Task TestGuestAccountGetter() { SetInitialData(); var guestAccountInfo = new GuestAccountInfo(); await _statisticsCollectorEngine.Collect( _statisticsCollectorFactory.CreateCollector(_dataStubs.AccountInfo.AccountId, guestAccountInfo)); Assert.NotNull(guestAccountInfo.AccountInfo); Assert.NotNull(guestAccountInfo.AccountInfo.PlayerStatistics); Assert.NotNull(guestAccountInfo.AccountInfo.AccountMasteryInfo); Assert.Equal(4, guestAccountInfo.AccountInfo.AccountMasteryInfo.Count()); Assert.NotNull(guestAccountInfo.AccountInfo.PlayerClanInfo); Assert.NotNull(guestAccountInfo.Tanks); Assert.Equal(_dataStubs.AccountTanksStatistics.Count, guestAccountInfo.Tanks.Count); Assert.NotNull(guestAccountInfo.Achievements); Assert.NotNull(guestAccountInfo.AggregatedAccountInfo); }
public BuildGuestAccountInfoOperation(GuestAccountInfo guestAccountInfo, IAccountsTankInfoDataAccessor dataAccessor, IBlitzStaticianDictionary dictionayDataAccessor) { _guestAccountInfo = guestAccountInfo; _accountsTankInfoDataAccessor = dataAccessor; _dictionaryDataAccessor = dictionayDataAccessor; _playerStatDtoMapper = new Mapper(new MapperConfiguration(m => m.CreateMap <AccountInfoStatistics, PlayerStatDto>())); _clanInfoMapper = new Mapper(new MapperConfiguration(m => m.CreateMap <AccountClanInfo, PlayerClanInfoDto>() .ForMember(d => d.PlayerRole, o => o.MapFrom(s => _dictionaryDataAccessor.GetClanRole(s.PlayerRole).GetAwaiter().GetResult())))); _tanksMapper = new Mapper(new MapperConfiguration(m => m.CreateMap <AccountTanksStatisticsTuple, AccountTankInfoDto>() .ForMember(d => d.VehicleTier, o => o.MapFrom(s => Convert.ToInt32(s.Vehicle.Tier))) .ForMember(d => d.TankTierRoman, o => o.MapFrom(s => Convert.ToInt32(s.Vehicle.Tier).ToRomanNumeral())) .ForMember(d => d.PreviewLocalImage, o => o.MapFrom(s => s.Vehicle.PreviewImageUrl.MakeImagePathLocal())) .ForMember(d => d.NormalLocalImage, o => o.MapFrom(s => s.Vehicle.NormalImageUrl.MakeImagePathLocal())) )); }
public IStatisticsCollector CreateCollector(long accountId, GuestAccountInfo guestAccountInfo) { return(new GuestAccountStatisticsCollector(_childScope, guestAccountInfo, accountId)); }