Пример #1
0
        public void Constructor_Should_Fail_If_Empty_Key()
        {
            var factoryOptions = new SteamWebInterfaceFactoryOptions()
            {
                SteamWebApiKey = ""
            };

            Assert.Throws <ArgumentNullException>(() => new SteamWebInterfaceFactory(Options.Create(factoryOptions)));
        }
Пример #2
0
        public SteamWebInterfaceFactoryTests()
        {
            var factoryOptions = new SteamWebInterfaceFactoryOptions()
            {
                SteamWebApiKey = "ABC123"
            };

            factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions));
        }
Пример #3
0
        public void Constructor_Should_Succeed()
        {
            var factoryOptions = new SteamWebInterfaceFactoryOptions()
            {
                SteamWebApiKey = "ABC123"
            };
            var factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions));

            Assert.NotNull(factory);
        }
Пример #4
0
        public SteamFactory()
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsetting.json");
            IConfiguration configuration  = builder.Build();
            var            factoryOptions = new SteamWebInterfaceFactoryOptions
            {
                SteamWebApiKey = configuration["SteamWebApiKey"]
            };

            Factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions));
        }
Пример #5
0
        public BaseTest()
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json")
                          .AddUserSecrets <CSGOServersTests>();

            configuration = builder.Build();

            var factoryOptions = new SteamWebInterfaceFactoryOptions()
            {
                SteamWebApiKey = configuration["SteamWebApiKey"]
            };

            factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions));
        }
Пример #6
0
 /// <summary>
 ///     Call the Steam API for data on a given game title.
 /// </summary>
 public static async Task <StoreAppDetailsDataModel> GetSteamAppAsync(string query)
 {
     try
     {
         var appId = SteamAppList.Data
                     .First(n => string.Equals(n.Name, query, StringComparison.InvariantCultureIgnoreCase)).AppId;
         var factoryOptions = new SteamWebInterfaceFactoryOptions
         {
             SteamWebApiKey = Program.Settings.Tokens.SteamToken
         };
         return(await new SteamWebInterfaceFactory(Options.Create(factoryOptions)).CreateSteamStoreInterface()
                .GetStoreAppDetailsAsync(appId).ConfigureAwait(false));
     }
     catch
     {
         return(null);
     }
 }