本文整理汇总了C#中Exceptionless.Core.Models.PersistentEvent.GetLocation方法的典型用法代码示例。如果您正苦于以下问题:C# PersistentEvent.GetLocation方法的具体用法?C# PersistentEvent.GetLocation怎么用?C# PersistentEvent.GetLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exceptionless.Core.Models.PersistentEvent
的用法示例。
在下文中一共展示了PersistentEvent.GetLocation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WillNotSetLocation
public async Task WillNotSetLocation() {
var plugin = new GeoPlugin(await GetResolverAsync(Log));
var ev = new PersistentEvent { Geo = GREEN_BAY_COORDINATES };
await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });
Assert.Equal(GREEN_BAY_COORDINATES, ev.Geo);
Assert.Null(ev.GetLocation());
}
示例2: WillResetLocation
public async Task WillResetLocation(string geo) {
var plugin = new GeoPlugin(await GetResolverAsync(Log));
var ev = new PersistentEvent { Geo = geo };
await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });
Assert.Null(ev.Geo);
Assert.Null(ev.GetLocation());
}
示例3: WillSetLocationFromGeo
public async Task WillSetLocationFromGeo() {
var plugin = new GeoPlugin(await GetResolverAsync(Log));
var ev = new PersistentEvent { Geo = GREEN_BAY_IP };
await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });
Assert.NotNull(ev.Geo);
Assert.NotEqual(GREEN_BAY_IP, ev.Geo);
var location = ev.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("WI", location?.Level1);
Assert.Equal("Green Bay", location?.Locality);
}
示例4: WillSetMultipleFromEmptyGeo
public async Task WillSetMultipleFromEmptyGeo() {
var plugin = new GeoPlugin(await GetResolverAsync(Log));
var ev = new PersistentEvent();
var greenBayEvent = new PersistentEvent();
greenBayEvent.SetEnvironmentInfo(new EnvironmentInfo { IpAddress = GREEN_BAY_IP });
var irvingEvent = new PersistentEvent();
irvingEvent.SetEnvironmentInfo(new EnvironmentInfo { IpAddress = IRVING_IP });
await plugin.EventBatchProcessingAsync(new List<EventContext> {
new EventContext(ev),
new EventContext(greenBayEvent),
new EventContext(irvingEvent)
});
Assert.Equal(GREEN_BAY_COORDINATES, greenBayEvent.Geo);
var location = greenBayEvent.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("WI", location?.Level1);
Assert.Equal("Green Bay", location?.Locality);
Assert.Equal(IRVING_COORDINATES, irvingEvent.Geo);
location = irvingEvent.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("TX", location?.Level1);
Assert.Equal("Irving", location?.Locality);
}
示例5: WillSetLocationFromEnvironmentInfoInfo
public async Task WillSetLocationFromEnvironmentInfoInfo() {
var plugin = new GeoPlugin(await GetResolverAsync(Log));
var ev = new PersistentEvent();
ev.SetEnvironmentInfo(new EnvironmentInfo { IpAddress = $"127.0.0.1,{GREEN_BAY_IP}" });
await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });
Assert.NotNull(ev.Geo);
var location = ev.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("WI", location?.Level1);
Assert.Equal("Green Bay", location?.Locality);
}
示例6: WillSetLocationFromRequestInfo
public async Task WillSetLocationFromRequestInfo() {
var plugin = new GeoPlugin(await GetResolverAsync());
var ev = new PersistentEvent();
ev.AddRequestInfo(new RequestInfo { ClientIpAddress = GREEN_BAY_IP });
await plugin.EventBatchProcessingAsync(new List<EventContext> { new EventContext(ev) });
Assert.NotNull(ev.Geo);
var location = ev.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("WI", location?.Level1);
Assert.Equal("Green Bay", location?.Locality);
}
示例7: WillNotSetFromMultipleGeo
public async Task WillNotSetFromMultipleGeo() {
var plugin = new GeoPlugin(await GetResolverAsync());
var ev = new PersistentEvent();
var greenBayEvent = new PersistentEvent { Geo = GREEN_BAY_IP };
var irvingEvent = new PersistentEvent { Geo = IRVING_IP };
await plugin.EventBatchProcessingAsync(new List<EventContext> {
new EventContext(ev),
new EventContext(greenBayEvent),
new EventContext(irvingEvent)
});
Assert.Equal(GREEN_BAY_COORDINATES, greenBayEvent.Geo);
var location = greenBayEvent.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("WI", location?.Level1);
Assert.Equal("Green Bay", location?.Locality);
Assert.Equal(IRVING_COORDINATES, irvingEvent.Geo);
location = irvingEvent.GetLocation();
Assert.Equal("US", location?.Country);
Assert.Equal("TX", location?.Level1);
Assert.Equal("Irving", location?.Locality);
}