public ItemInOfferTransactionIntegrationTest(ItemInOfferTransactionIntegrationTestSetup setup)
 {
     _setup    = setup;
     _database = setup.Database;
     _itemInOfferTransactionRepoService =
         new ItemInOfferTransactionRepoService(_setup.DatabaseConnectionFactory, new ItemInOfferTransactionQueries());
 }
Пример #2
0
 public ItemService(IRepoServiceFactory repoServiceFactory)
 {
     _matchRepoService                   = repoServiceFactory.MatchRepoService;
     _betRepoService                     = repoServiceFactory.BetRepoService;
     _itemRepoSerive                     = repoServiceFactory.ItemRepoService;
     _itemDescriptionRepoService         = repoServiceFactory.ItemDescriptionRepoService;
     _itemBettedRepoService              = repoServiceFactory.ItemBettedRepoService;
     _itemsInOfferTransactionRepoService = repoServiceFactory.ItemInOfferTransactionRepoService;
     _offerTransactionRepoService        = repoServiceFactory.OfferTranascrionRepoService;
     _coinFlipMatchRepoService           = repoServiceFactory.CoinFlipMatchRepoService;
     _gameModeRepoService                = repoServiceFactory.GameModeRepoService;
 }
Пример #3
0
 public OfferService(IRepoServiceFactory factory, ITransactionFactory transactionFactory, ILogServiceFactory logServiceFactory)
 {
     _itemDescRepoServcice = factory.ItemDescriptionRepoService;
     _botRepoService       = factory.BotRepoService;
     _userRepoService      = factory.UserRepoService;
     _itemRepoService      = factory.ItemRepoService;
     _offerRepoService     = factory.OfferTranascrionRepoService;
     _itemInOfferTransactionRepoService = factory.ItemInOfferTransactionRepoService;
     _transactionFactory = transactionFactory;
     _logService         = logServiceFactory.CreateLogger <OfferService>();
     _steamLock          = new TimeSpan(7, 1, 0, 0);
 }
Пример #4
0
 public RepoServiceFactory
 (
     IBetRepoService betRepoService,
     IItemDescriptionRepoService descriptionRepoService,
     IItemBettedRepoService itemBettedRepoService,
     IUserRepoService userRepoService,
     IMatchRepoService matchRepoService,
     IItemRepoService itemRepoService,
     IBotRepoService botRepoService,
     IItemInOfferTransactionRepoService inOfferTransactionRepoService,
     IOfferTranascrionRepoService offerTranascrionRepoService,
     ISettingRepoService settingRepoService,
     IRakeItemRepoService rakeItemRepoService,
     IStaffRepoService staffRepoService,
     ILevelRepoService levelRepoService,
     IGameModeRepoService gameModeRepoService,
     IJackpotSettingRepo jackpotSettingRepo,
     ICoinFlipMatchRepoService coinFlipMatchRepoService)
 {
     ItemInOfferTransactionRepoService = inOfferTransactionRepoService;
     OfferTranascrionRepoService       = offerTranascrionRepoService;
     SettingRepoService         = settingRepoService;
     RakeItemRepoService        = rakeItemRepoService;
     StaffRepoService           = staffRepoService;
     LevelRepoService           = levelRepoService;
     GameModeRepoService        = gameModeRepoService;
     JackpotSettingRepo         = jackpotSettingRepo;
     CoinFlipMatchRepoService   = coinFlipMatchRepoService;
     BetRepoService             = betRepoService;
     ItemDescriptionRepoService = descriptionRepoService;
     ItemBettedRepoService      = itemBettedRepoService;
     UserRepoService            = userRepoService;
     MatchRepoService           = matchRepoService;
     ItemRepoService            = itemRepoService;
     BotRepoService             = botRepoService;
 }
Пример #5
0
        public ItemServiceTest()
        {
            _matchRepoService                   = A.Fake <IMatchRepoService>();
            _betRepoService                     = A.Fake <IBetRepoService>();
            _itemRepoService                    = A.Fake <IItemRepoService>();
            _descriptionRepoService             = A.Fake <IItemDescriptionRepoService>();
            _itemBettedRepoSerivce              = A.Fake <IItemBettedRepoService>();
            _offerTransactionRepoService        = A.Fake <IOfferTranascrionRepoService>();
            _itemsInOfferTransactionRepoService = A.Fake <IItemInOfferTransactionRepoService>();
            _fakedCoinFlipService               = A.Fake <ICoinFlipMatchRepoService>();
            _fakedUserRepoService               = A.Fake <IUserRepoService>();


            _fakedRepoService = A.Fake <IRepoServiceFactory>();
            A.CallTo(() => _fakedRepoService.MatchRepoService).Returns(_matchRepoService);
            A.CallTo(() => _fakedRepoService.BetRepoService).Returns(_betRepoService);
            A.CallTo(() => _fakedRepoService.ItemRepoService).Returns(_itemRepoService);
            A.CallTo(() => _fakedRepoService.ItemDescriptionRepoService).Returns(_descriptionRepoService);
            A.CallTo(() => _fakedRepoService.ItemBettedRepoService).Returns(_itemBettedRepoSerivce);
            A.CallTo(() => _fakedRepoService.OfferTranascrionRepoService).Returns(_offerTransactionRepoService);
            A.CallTo(() => _fakedRepoService.ItemInOfferTransactionRepoService).Returns(_itemsInOfferTransactionRepoService);
            A.CallTo(() => _fakedRepoService.CoinFlipMatchRepoService).Returns(_fakedCoinFlipService);
            A.CallTo(() => _fakedRepoService.UserRepoService).Returns(_fakedUserRepoService);
        }
Пример #6
0
        public OfferTransactionServiceTest()
        {
            var fakedItemDescriptionRepoService = A.Fake <IItemDescriptionRepoService>();
            var fakedTransactionFactory         = A.Fake <ITransactionFactory>();
            var fakedRepoServiceFactory         = A.Fake <IRepoServiceFactory>();

            _fakedItemInOfferTransactionRepoService = A.Fake <IItemInOfferTransactionRepoService>();
            _fakedOfferTranascrionRepoService       = A.Fake <IOfferTranascrionRepoService>();
            _fakedUserRepoService = A.Fake <IUserRepoService>();
            _fakedBotRepoService  = A.Fake <IBotRepoService>();
            _fakedItemRepoService = A.Fake <IItemRepoService>();

            _fakedTransactionWrapper = A.Fake <ITransactionWrapper>();

            A.CallTo(() => fakedRepoServiceFactory.ItemInOfferTransactionRepoService).Returns(_fakedItemInOfferTransactionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.OfferTranascrionRepoService).Returns(_fakedOfferTranascrionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.UserRepoService).Returns(_fakedUserRepoService);
            A.CallTo(() => fakedRepoServiceFactory.BotRepoService).Returns(_fakedBotRepoService);
            A.CallTo(() => fakedRepoServiceFactory.ItemDescriptionRepoService).Returns(fakedItemDescriptionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.ItemRepoService).Returns(_fakedItemRepoService);
            A.CallTo(() => fakedTransactionFactory.BeginTransaction()).Returns(_fakedTransactionWrapper);

            _offerMinmalInfo = new OfferStatusRequest
            {
                Bot = new Bot
                {
                    Username = "******",
                    SteamId  = "botSteamId"
                },
                SteamId       = "userSteamId",
                StatusCode    = int.MinValue,
                StatusMessage = "",
                OfferSend     = new OfferStatusOffer
                {
                    SteamOffer = new SteamOffer
                    {
                        ItemsToGive =
                        {
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "1", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "2", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "3", MarketHashName = "SomeWeapon2"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "4", MarketHashName = "SomeWeapon3"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "5", MarketHashName = "SomeWeapon4"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "6", MarketHashName = "SomeWeapon2"
                            },
                        },
                        ItemsToReceive =
                        {
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "11", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "12", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "13", MarketHashName = "SomeWeapon2"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "14", MarketHashName = "SomeWeapon3"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "15", MarketHashName = "SomeWeapon4"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "16", MarketHashName = "SomeWeapon2"
                            },
                        },
                    }
                }
            };


            var someWeapon1 = new DatabaseModel.ItemDescription("SomeWeapon1", new decimal(11.22), "720", "2", "imgUrl", true, 1);
            var someWeapon2 = new DatabaseModel.ItemDescription("SomeWeapon2", new decimal(45.5), "720", "2", "imgUrl", true, 2);
            var someWeapon3 = new DatabaseModel.ItemDescription("SomeWeapon3", new decimal(78.00), "720", "2", "imgUrl", true, 3);
            var someWeapon4 = new DatabaseModel.ItemDescription("SomeWeapon4", new decimal(5.47), "720", "2", "imgUrl", true, 4);

            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon1")).Returns(someWeapon1);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon2")).Returns(someWeapon2);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon3")).Returns(someWeapon3);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon4")).Returns(someWeapon4);

            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync(A <List <string> > ._)).Returns(new List <DatabaseModel.ItemDescription>
            {
                someWeapon1,
                someWeapon2,
                someWeapon3,
                someWeapon4,
            });


            _offerService = new OfferService(fakedRepoServiceFactory, fakedTransactionFactory, A.Dummy <ILogServiceFactory>());
        }