47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
using Xunit;
|
|||
|
|
using System.Linq;
|
||
|
|
using SuccessfulCode.BetfairApi.BettingModels;
|
||
|
|
|
||
|
|
namespace SuccessfulCode.BetfairApi.Tests
|
||
|
|
{
|
||
|
|
public class EventsTests
|
||
|
|
{
|
||
|
|
[Theory]
|
||
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
||
|
|
public void TestGetEventsTypes(string username, string password, string appKey)
|
||
|
|
{
|
||
|
|
//Arrange
|
||
|
|
var auth = new Authentication(username, password, appKey);
|
||
|
|
var client = new BettingApiClient(auth);
|
||
|
|
|
||
|
|
//Act
|
||
|
|
var eventsTypes = client.ListEventTypes(new BettingModels.MarketFilter()).Result;
|
||
|
|
|
||
|
|
//Assert
|
||
|
|
Assert.True(eventsTypes.Length > 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Theory]
|
||
|
|
[InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
|
||
|
|
public void TestGetEvents(string username, string password, string appKey)
|
||
|
|
{
|
||
|
|
//Arrange
|
||
|
|
var auth = new Authentication(username, password, appKey);
|
||
|
|
var client = new BettingApiClient(auth);
|
||
|
|
var eventTypes = client.ListEventTypes(new MarketFilter()).Result;
|
||
|
|
var horseRacingEventType = eventTypes.FirstOrDefault(e => e.EventType.Name == "Horse Racing");
|
||
|
|
var filter = new MarketFilter()
|
||
|
|
{
|
||
|
|
EventTypeIds = new[] { horseRacingEventType.EventType.Id },
|
||
|
|
MarketCountries = new[] { "IE", "US" }
|
||
|
|
};
|
||
|
|
|
||
|
|
//Act
|
||
|
|
var horseRacingEvents = client.ListEvents(filter).Result;
|
||
|
|
|
||
|
|
//Assert
|
||
|
|
Assert.True(horseRacingEvents.Length > 0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|