public void Constructor_Should_Fail_If_Empty_Key() { var factoryOptions = new SteamWebInterfaceFactoryOptions() { SteamWebApiKey = "" }; Assert.Throws <ArgumentNullException>(() => new SteamWebInterfaceFactory(Options.Create(factoryOptions))); }
public SteamWebInterfaceFactoryTests() { var factoryOptions = new SteamWebInterfaceFactoryOptions() { SteamWebApiKey = "ABC123" }; factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions)); }
public void Constructor_Should_Succeed() { var factoryOptions = new SteamWebInterfaceFactoryOptions() { SteamWebApiKey = "ABC123" }; var factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions)); Assert.NotNull(factory); }
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)); }
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)); }
/// <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); } }