本文整理汇总了C#中StateManager.AddRules方法的典型用法代码示例。如果您正苦于以下问题:C# StateManager.AddRules方法的具体用法?C# StateManager.AddRules怎么用?C# StateManager.AddRules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateManager
的用法示例。
在下文中一共展示了StateManager.AddRules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Adapter
public Adapter(ISettings settings, IServiceFacade udapiServiceFacade, IAdapterPlugin platformConnector, IStreamListenerManager listenersManager)
{
_listenersManager = listenersManager;
Settings = settings;
UDAPIService = udapiServiceFacade;
PlatformConnector = platformConnector;
var statemanager = new StateManager(settings,platformConnector);
StateManager = statemanager;
StateProviderProxy.Init(statemanager);
listenersManager.StateManager = statemanager;
if (settings.StatsEnabled)
StatsManager.Configure();
// we just need the initialisation
new SuspensionManager(statemanager, PlatformConnector);
platformConnector.Initialise();
statemanager.AddRules(platformConnector.MarketRules);
ThreadPool.SetMinThreads(500, 500);
_sports = new List<string>();
_stats = StatsManager.Instance["adapter.core"].GetHandle();
PopuplateAdapterVersionInfo();
}
示例2: DeltaRuleWithRealFixtureTest
public void DeltaRuleWithRealFixtureTest()
{
var settings = new Mock<ISettings>();
var plugin = new Mock<IAdapterPlugin>();
var state = new StateManager(settings.Object, plugin.Object);
DeltaRule.Instance.Severity = DeltaRule.DeltaRuleSeverity.REMOVE_SELECTIONS;
List<IMarketRule> rules = new List<IMarketRule> {DeltaRule.Instance};
state.ClearState("nr7B1f7gjMuk2ggCJoMIizHKrfI");
var manager = state.CreateNewMarketRuleManager("nr7B1f7gjMuk2ggCJoMIizHKrfI");
state.AddRules(rules);
Fixture fixture = TestHelper.GetFixtureFromResource("rugbydata_snapshot_2");
int mkt_count = fixture.Markets.Count;
mkt_count.Should().BeGreaterThan(0);
// first apply should do anything as there is no state
manager.ApplyRules(fixture);
fixture.Markets.Count().Should().Be(mkt_count);
// from now on, we have a state
manager.CommitChanges();
Fixture snapshot = TestHelper.GetFixtureFromResource("rugbydata_snapshot_4");
manager.ApplyRules(snapshot);
manager.CommitChanges();
// snapshot 2 and snapshot-4 have no difference, so everything should have been
// remove by the delta rule
snapshot.Markets.Count().Should().Be(0);
}