77 lines
2.7 KiB
C#
77 lines
2.7 KiB
C#
using SuccessfulCode.BetfairApi.BettingModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Xunit;
|
|
|
|
namespace SuccessfulCode.BetfairApi.Tests
|
|
{
|
|
public class MarketTests
|
|
{
|
|
[Theory]
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
|
public void ListMarketTypes(string username, string password, string appKey)
|
|
{
|
|
//Arrange
|
|
var auth = new Authentication(username, password, appKey);
|
|
var client = new BettingApiClient(auth);
|
|
|
|
//Act
|
|
var results = client.ListMarketTypes(new MarketFilter() { EventTypeIds = new[] { "7" } }).Result;
|
|
|
|
//Assert
|
|
Assert.True(results.Length > 0);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
|
public void GetHorseWinMarkets(string username, string password, string appKey)
|
|
{
|
|
//Arrange
|
|
var auth = new Authentication(username, password, appKey);
|
|
var client = new BettingApiClient(auth);
|
|
var horseRacingQueries = new BetfairHorseRacingQueries(client);
|
|
|
|
//Act
|
|
var horseWins = horseRacingQueries.GetHorseWinCatalogue(DateTime.UtcNow, DateTime.UtcNow.AddDays(20), "GB").Result;
|
|
|
|
//Assert
|
|
Assert.True(horseWins.Length > 0);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
|
public void GetHorseMarketBook(string username, string password, string appKey)
|
|
{
|
|
//Arrange
|
|
var auth = new Authentication(username, password, appKey);
|
|
var client = new BettingApiClient(auth);
|
|
var horseRacingQueries = new BetfairHorseRacingQueries(client);
|
|
var horseWins = horseRacingQueries.GetHorseWinCatalogue(DateTime.UtcNow, DateTime.UtcNow.AddDays(1), "GB").Result;
|
|
|
|
//Act
|
|
var prices = horseRacingQueries.GetBestPrices(horseWins[0].MarketId).Result;
|
|
|
|
//Assert
|
|
Assert.True(horseWins.Length > 0);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
|
public void GetSpecificBook(string username, string password, string appKey)
|
|
{
|
|
//Arrange
|
|
var auth = new Authentication(username, password, appKey);
|
|
var client = new BettingApiClient(auth);
|
|
var horseRacingQueries = new BetfairHorseRacingQueries(client);
|
|
|
|
|
|
//Act
|
|
var books = client.ListMarketBook(new[] { "1.166887988" }).Result;
|
|
|
|
//Assert
|
|
Assert.True(books.Length > 0);
|
|
}
|
|
}
|
|
} |