public void Unsubscribe(string eventString) { eventString = eventString + "/" + Context.ConnectionId; var e = EventParser.Parse(eventString, services); Engine.Instance.Push(e); }
private async Task ServiceBusMessagePump_PublishServiceBusMessage_MessageSuccessfullyProcessed(Encoding messageEncoding, string connectionStringKey) { // Arrange var operationId = Guid.NewGuid().ToString(); var transactionId = Guid.NewGuid().ToString(); var connectionString = Configuration.GetValue <string>(connectionStringKey); ServiceBusConnectionStringProperties serviceBusConnectionString = ServiceBusConnectionStringProperties.Parse(connectionString); await using (var client = new ServiceBusClient(connectionString)) await using (ServiceBusSender messageSender = client.CreateSender(serviceBusConnectionString.EntityPath)) { var order = OrderGenerator.Generate(); var orderMessage = order.AsServiceBusMessage(operationId, transactionId, encoding: messageEncoding); // Act await messageSender.SendMessageAsync(orderMessage); // Assert var receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(operationId); Assert.NotEmpty(receivedEvent); var deserializedEventGridMessage = EventParser.Parse(receivedEvent); Assert.NotNull(deserializedEventGridMessage); var orderCreatedEvent = Assert.Single(deserializedEventGridMessage.Events); Assert.NotNull(orderCreatedEvent); var orderCreatedEventData = orderCreatedEvent.GetPayload <OrderCreatedEventData>(); Assert.NotNull(orderCreatedEventData); Assert.NotNull(orderCreatedEventData.CorrelationInfo); Assert.Equal(order.Id, orderCreatedEventData.Id); Assert.Equal(order.Amount, orderCreatedEventData.Amount); Assert.Equal(order.ArticleNumber, orderCreatedEventData.ArticleNumber); Assert.Equal(transactionId, orderCreatedEventData.CorrelationInfo.TransactionId); Assert.Equal(operationId, orderCreatedEventData.CorrelationInfo.OperationId); Assert.NotEmpty(orderCreatedEventData.CorrelationInfo.CycleId); } }
//TODO: We need a better separation of methods for event pushing. public void Push(string eventString) { eventString = eventString + ";" + Context.ConnectionId; var e = EventParser.Parse(eventString, serviceProvider); Engine.Instance.Push(e); }
public void ParseExplicitAsCloudEvent_ValidBlobCreatedEvent_ShouldSucceed() { // Arrange const string topic = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", subject = "/blobServices/default/containers/event-container/blobs/finnishjpeg", eventType = "Microsoft.Storage.BlobCreated", id = "5647b67c-b01e-002d-6a47-bc01ac063360", api = "PutBlockList", clientRequestId = "5c24a322-35c9-4b46-8ef5-245a81af7037", requestId = "5647b67c-b01e-002d-6a47-bc01ac000000", eTag = "0x8D58A5F0C6722F9", contentType = "image/jpeg", blobType = "BlockBlob", url = "https://sample.blob.core.windows.net/event-container/finnish.jpeg", sequencer = "00000000000000000000000000000094000000000017d503", batchId = "69cd1576-e430-4aff-8153-570934a1f6e1"; const int contentLength = 29342; var eventTime = DateTimeOffset.Parse("2018-03-15T10:25:17.7535274"); var source = new Uri("/some/source/not/available/in/event-grid/events", UriKind.Relative); string rawEvent = EventSamples.BlobCreateEvent; var eventGridEventBatch = EventParser.Parse(rawEvent); Assert.NotNull(eventGridEventBatch); Event @event = Assert.Single(eventGridEventBatch.Events); Assert.NotNull(@event); // Act CloudEvent cloudEvent = @event.AsCloudEvent(source); // Assert Assert.NotNull(cloudEvent); Assert.Equal(topic, @event.Topic); Assert.Equal(subject, cloudEvent.Subject); Assert.Equal(eventType, cloudEvent.Type); Assert.Equal(eventTime, cloudEvent.Time.GetValueOrDefault()); Assert.Equal(id, cloudEvent.Id); var eventPayload = cloudEvent.GetPayload <StorageBlobCreatedEventData>(); Assert.NotNull(eventPayload); Assert.Equal(api, eventPayload.Api); Assert.Equal(clientRequestId, eventPayload.ClientRequestId); Assert.Equal(requestId, eventPayload.RequestId); Assert.Equal(eTag, eventPayload.ETag); Assert.Equal(contentType, eventPayload.ContentType); Assert.Equal(contentLength, eventPayload.ContentLength); Assert.Equal(blobType, eventPayload.BlobType); Assert.Equal(url, eventPayload.Url); Assert.Equal(sequencer, eventPayload.Sequencer); Assert.NotNull(eventPayload.StorageDiagnostics); var storageDiagnostics = Assert.IsType <JObject>(eventPayload.StorageDiagnostics); Assert.Equal(batchId, storageDiagnostics["batchId"]); }
public void ParseImplicit_ValidBlobCreatedEvent_ShouldSucceed() { // Arrange const string topic = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; const string subject = "/blobServices/default/containers/event-container/blobs/finnishjpeg"; const string eventType = "Microsoft.Storage.BlobCreated"; const string id = "5647b67c-b01e-002d-6a47-bc01ac063360"; const string dataVersion = "1"; const string metadataVersion = "1"; const string api = "PutBlockList"; const string clientRequestId = "5c24a322-35c9-4b46-8ef5-245a81af7037"; const string requestId = "5647b67c-b01e-002d-6a47-bc01ac000000"; const string eTag = "0x8D58A5F0C6722F9"; const string contentType = "image/jpeg"; const int contentLength = 29342; const string blobType = "BlockBlob"; const string url = "https://sample.blob.core.windows.net/event-container/finnish.jpeg"; const string sequencer = "00000000000000000000000000000094000000000017d503"; const string batchId = "69cd1576-e430-4aff-8153-570934a1f6e1"; string rawEvent = EventSamples.BlobCreateEvent; var eventTime = DateTimeOffset.Parse("2018-03-15T10:25:17.7535274Z"); // Act EventBatch <Event> eventGridMessage = EventParser.Parse(rawEvent); // Assert Assert.NotNull(eventGridMessage); Assert.NotNull(eventGridMessage.Events); Event eventGridEvent = Assert.Single(eventGridMessage.Events); Assert.NotNull(eventGridEvent); Assert.Equal(topic, eventGridEvent.Topic); Assert.Equal(subject, eventGridEvent.Subject); Assert.Equal(eventType, eventGridEvent.EventType); Assert.Equal(eventTime, eventGridEvent.EventTime); Assert.Equal(id, eventGridEvent.Id); Assert.Equal(dataVersion, eventGridEvent.DataVersion); Assert.Equal(metadataVersion, eventGridEvent.MetadataVersion); var eventPayload = eventGridEvent.GetPayload <StorageBlobCreatedEventData>(); Assert.NotNull(eventPayload); Assert.Equal(api, eventPayload.Api); Assert.Equal(clientRequestId, eventPayload.ClientRequestId); Assert.Equal(requestId, eventPayload.RequestId); Assert.Equal(eTag, eventPayload.ETag); Assert.Equal(contentType, eventPayload.ContentType); Assert.Equal(contentLength, eventPayload.ContentLength); Assert.Equal(blobType, eventPayload.BlobType); Assert.Equal(url, eventPayload.Url); Assert.Equal(sequencer, eventPayload.Sequencer); Assert.NotNull(eventPayload.StorageDiagnostics); var storageDiagnostics = Assert.IsType <JObject>(eventPayload.StorageDiagnostics); Assert.Equal(batchId, storageDiagnostics["batchId"]); }
public void ParseEventExplicit_ValidStorageBlobCreatedCloudEvent_ShouldSucceed() { // Arrange const CloudEventsSpecVersion cloudEventsVersion = CloudEventsSpecVersion.V0_1; const string eventType = "Microsoft.Storage.BlobCreated", source = "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}#blobServices/default/containers/{storage-container}/blobs/{new-file}", eventId = "173d9985-401e-0075-2497-de268c06ff25", eventTime = "2018-04-28T02:18:47.1281675Z"; const string api = "PutBlockList", clientRequestId = "6d79dbfb-0e37-4fc4-981f-442c9ca65760", requestId = "831e1650-001e-001b-66ab-eeb76e000000", etag = "0x8D4BCC2E4835CD0", contentType = "application/octet-stream", blobType = "BlockBlob", url = "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", sequencer = "00000000000004420000000000028963", batchId = "b68529f3-68cd-4744-baa4-3c0498ec19f0"; const long contentLength = 524_288; string rawEvent = EventSamples.AzureBlobStorageCreatedCloudEvent; // Act EventBatch <Event> eventBatch = EventParser.Parse(rawEvent); // Assert Assert.NotNull(eventBatch); Assert.NotNull(eventBatch.Events); CloudEvent cloudEvent = Assert.Single(eventBatch.Events); Assert.NotNull(cloudEvent); Assert.Equal(cloudEventsVersion, cloudEvent.SpecVersion); Assert.Equal(eventType, cloudEvent.Type); Assert.Equal(source, cloudEvent.Source.OriginalString); Assert.Equal(eventId, cloudEvent.Id); Assert.Equal(eventTime, cloudEvent.Time.GetValueOrDefault().ToString("O")); var eventPayload = cloudEvent.GetPayload <StorageBlobCreatedEventData>(); Assert.NotNull(eventPayload); Assert.Equal(api, eventPayload.Api); Assert.Equal(clientRequestId, eventPayload.ClientRequestId); Assert.Equal(requestId, eventPayload.RequestId); Assert.Equal(etag, eventPayload.ETag); Assert.Equal(contentType, eventPayload.ContentType); Assert.Equal(contentLength, eventPayload.ContentLength); Assert.Equal(blobType, eventPayload.BlobType); Assert.Equal(url, eventPayload.Url); Assert.Equal(sequencer, eventPayload.Sequencer); Assert.NotNull(eventPayload.StorageDiagnostics); var storageDiagnostics = Assert.IsType <JObject>(eventPayload.StorageDiagnostics); Assert.Equal(batchId, storageDiagnostics["batchId"]); }
public void ParseExplicitAsEventGridEvent_ValidStorageBlobCreatedCloudEvent_ShouldSucceed() { // Arrange const string eventType = "Microsoft.Storage.BlobCreated", eventId = "173d9985-401e-0075-2497-de268c06ff25", eventTime = "2018-04-28T02:18:47.1281675"; const string api = "PutBlockList", clientRequestId = "6d79dbfb-0e37-4fc4-981f-442c9ca65760", requestId = "831e1650-001e-001b-66ab-eeb76e000000", etag = "0x8D4BCC2E4835CD0", contentType = "application/octet-stream", blobType = "BlockBlob", url = "https://oc2d2817345i60006.blob.core.windows.net/oc2d2817345i200097container/oc2d2817345i20002296blob", sequencer = "00000000000004420000000000028963", batchId = "b68529f3-68cd-4744-baa4-3c0498ec19f0"; const long contentLength = 524_288; string rawEvent = EventSamples.AzureBlobStorageCreatedCloudEvent; EventBatch <Event> eventBatch = EventParser.Parse(rawEvent); Assert.NotNull(eventBatch); Event @event = Assert.Single(eventBatch.Events); Assert.NotNull(@event); // Act EventGridEvent eventGridEvent = @event.AsEventGridEvent(); // Assert Assert.NotNull(eventGridEvent); Assert.Equal(eventType, eventGridEvent.EventType); Assert.Equal(eventId, eventGridEvent.Id); Assert.Equal(eventTime, eventGridEvent.EventTime.ToString("O")); var eventPayload = eventGridEvent.GetPayload <StorageBlobCreatedEventData>(); Assert.NotNull(eventPayload); Assert.Equal(api, eventPayload.Api); Assert.Equal(clientRequestId, eventPayload.ClientRequestId); Assert.Equal(requestId, eventPayload.RequestId); Assert.Equal(etag, eventPayload.ETag); Assert.Equal(contentType, eventPayload.ContentType); Assert.Equal(contentLength, eventPayload.ContentLength); Assert.Equal(blobType, eventPayload.BlobType); Assert.Equal(url, eventPayload.Url); Assert.Equal(sequencer, eventPayload.Sequencer); Assert.NotNull(eventPayload.StorageDiagnostics); var storageDiagnostics = Assert.IsType <JObject>(eventPayload.StorageDiagnostics); Assert.Equal(batchId, storageDiagnostics["batchId"]); }
public async Task <Event> GetEvent(string eventId) { var urlPart = $"state=verpublish&status=init&vmfile=no&publishid={eventId}&moduleCall=webInfo&publishConfFile=webInfo&publishSubDir=veranstaltung"; var document = await _httpClient.GetHtmlAsync(_httpClient.Url(urlPart)); var links = _parser.GetIcalLinksFromDocument(document); var icals = await Task.WhenAll(links.Select(_httpClient.GetStringAsync)); var calendars = icals.Select(source => _parser.ParseICalendar(source)); return(_parser.Parse(eventId, calendars)); }
private Event GetReceivedEvent(string eventId) { string receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(eventId); EventBatch <Event> rawEvents = EventParser.Parse(receivedEvent); Assert.NotNull(rawEvents); Assert.NotNull(rawEvents.Events); Event firstEvent = Assert.Single(rawEvents.Events); Assert.NotNull(firstEvent); return(firstEvent); }
public ActionResult EditEvent(ViewEventModel viewEventModel) { EventModel @event = EventParser.Parse(viewEventModel); @event.UserId = db.GetById(@event.Id).UserId; if (@event.UserId == User.Identity.GetUserId() && ModelState.IsValid) { var eventDTO = Mapper.Map <EventModel, EventDTO>(@event); db.EditEvent(eventDTO); return(RedirectToAction("EventForm")); } else { return(View(@event)); } }
public ActionResult AddEvent(ViewEventModel viewEventModel) { if (ModelState.IsValid) { EventModel @event = EventParser.Parse(viewEventModel); @event.UserId = User.Identity.GetUserId(); var eventDTO = Mapper.Map <EventModel, EventDTO>(@event); db.AddEvent(eventDTO); // ParticipantService.AddParticapant(new ParticipantDTO { Email=User.Identity.GetUserName()}) return(RedirectToAction("EventForm")); } else { return(View()); } }
/// <summary> /// Simulate the message processing of the message pump using the Service Bus. /// </summary> public async Task SimulateMessageProcessingAsync() { if (_serviceBusEventConsumerHost is null) { throw new InvalidOperationException( "Cannot simulate the message pump because the service is not yet started; please start this service before simulating"); } var operationId = Guid.NewGuid().ToString(); var transactionId = Guid.NewGuid().ToString(); string connectionString = _configuration.GetServiceBusConnectionString(_entity); var connectionStringProperties = ServiceBusConnectionStringProperties.Parse(connectionString); await using (var client = new ServiceBusClient(connectionString)) await using (ServiceBusSender messageSender = client.CreateSender(connectionStringProperties.EntityPath)) { try { Order order = GenerateOrder(); ServiceBusMessage orderMessage = order.AsServiceBusMessage(operationId, transactionId); await messageSender.SendMessageAsync(orderMessage); string receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(operationId); Assert.NotEmpty(receivedEvent); EventBatch <Event> eventBatch = EventParser.Parse(receivedEvent); Assert.NotNull(eventBatch); Event orderCreatedEvent = Assert.Single(eventBatch.Events); Assert.NotNull(orderCreatedEvent); var orderCreatedEventData = orderCreatedEvent.GetPayload <OrderCreatedEventData>(); Assert.NotNull(orderCreatedEventData); Assert.NotNull(orderCreatedEventData.CorrelationInfo); Assert.Equal(order.Id, orderCreatedEventData.Id); Assert.Equal(order.Amount, orderCreatedEventData.Amount); Assert.Equal(order.ArticleNumber, orderCreatedEventData.ArticleNumber); Assert.Equal(transactionId, orderCreatedEventData.CorrelationInfo.TransactionId); Assert.Equal(operationId, orderCreatedEventData.CorrelationInfo.OperationId); Assert.NotEmpty(orderCreatedEventData.CorrelationInfo.CycleId); } finally { await messageSender.CloseAsync(); } } }
public async Task ParseEventAsync([Remainder] string content) { EventContext context = new EventContext(Context.Server, Context.Guild, Context.Guild.GetUser(Context.User.Id)); StringBuilder result = new StringBuilder(); result.AppendLine("```bf"); result.AppendLine("Input:"); result.AppendLine(content); result.AppendLine("```"); result.AppendLine("**Output**:"); result.Append(EventParser.Parse(content, context)); await Context.Channel.SendMessageAsync(result.ToString()); }
/// <summary> /// Simulate the message processing of the message pump using the Azure Service Bus. /// </summary> /// <param name="connectionString">The connection string used to send a Azure Service Bus message to the respectively running message pump.</param> /// <exception cref="ArgumentException">Thrown when the <paramref name="connectionString"/> is blank.</exception> public async Task SimulateMessageProcessingAsync(string connectionString) { Guard.NotNullOrWhitespace(connectionString, nameof(connectionString)); if (_serviceBusEventConsumerHost is null) { throw new InvalidOperationException( "Cannot simulate the message pump because the service is not yet started; please start this service before simulating"); } var operationId = Guid.NewGuid().ToString(); var transactionId = Guid.NewGuid().ToString(); Order order = OrderGenerator.Generate(); ServiceBusMessage orderMessage = order.AsServiceBusMessage(operationId, transactionId); orderMessage.ApplicationProperties["Topic"] = "Orders"; await SendMessageToServiceBusAsync(connectionString, orderMessage); string receivedEvent = _serviceBusEventConsumerHost.GetReceivedEvent(operationId, retryCount: 10); Assert.NotEmpty(receivedEvent); EventBatch <Event> eventBatch = EventParser.Parse(receivedEvent); Assert.NotNull(eventBatch); Event orderCreatedEvent = Assert.Single(eventBatch.Events); Assert.NotNull(orderCreatedEvent); var orderCreatedEventData = orderCreatedEvent.GetPayload <OrderCreatedEventData>(); Assert.NotNull(orderCreatedEventData); Assert.NotNull(orderCreatedEventData.CorrelationInfo); Assert.Equal(order.Id, orderCreatedEventData.Id); Assert.Equal(order.Amount, orderCreatedEventData.Amount); Assert.Equal(order.ArticleNumber, orderCreatedEventData.ArticleNumber); Assert.Equal(transactionId, orderCreatedEventData.CorrelationInfo.TransactionId); Assert.Equal(operationId, orderCreatedEventData.CorrelationInfo.OperationId); Assert.NotEmpty(orderCreatedEventData.CorrelationInfo.CycleId); }
/// <summary> /// Asserts the <see cref="NewCarRegistered"/> event. /// </summary> public static void ReceivedNewCarRegisteredEvent(string eventId, string eventType, string eventSubject, string licensePlate, string receivedEvent) { Assert.NotEqual(String.Empty, receivedEvent); EventBatch <Event> deserializedEventGridMessage = EventParser.Parse(receivedEvent); Assert.NotNull(deserializedEventGridMessage); Assert.NotEmpty(deserializedEventGridMessage.SessionId); Assert.NotNull(deserializedEventGridMessage.Events); Event deserializedEvent = Assert.Single(deserializedEventGridMessage.Events); Assert.NotNull(deserializedEvent); Assert.Equal(eventId, deserializedEvent.Id); Assert.Equal(eventSubject, deserializedEvent.Subject); Assert.Equal(eventType, deserializedEvent.EventType); Assert.NotNull(deserializedEvent.Data); var eventData = deserializedEvent.GetPayload <CarEventData>(); Assert.NotNull(eventData); Assert.Equal(JsonConvert.DeserializeObject <CarEventData>(deserializedEvent.Data.ToString()), eventData); Assert.Equal(licensePlate, eventData.LicensePlate); }
public CalenderViewModel() { Title = "Calender"; Items = EventParser.Parse(Settings.Username); GoToDetailsCommand = new Command <string>(ExecuteGoToDetailsCommand); }
public BrowseItemsViewModel() { Title = "Events"; Items = new ObservableRangeCollection <EventItemViewModel>(EventParser.Parse(Settings.Username).Select(e => new EventItemViewModel(e))); GoToDetailsCommand = new Command <string>(ExecuteGoToDetailsCommand); }
public void Parse_ReturnsEvent() { // Arrange dynamic json = JObject.Parse(TestJson.Get("event")); var sut = new EventParser(); // Act Event result = sut.Parse(json); // Assert Assert.AreEqual(116, result.Id); Assert.AreEqual("Acts of Vengeance!", result.Title); Assert.AreEqual("Loki sets about convincing the super-villains of Earth to attack heroes other than those they normally fight in an attempt to destroy the Avengers to absolve his guilt over inadvertently creating the team in the first place.", result.Description); Assert.AreEqual(2, result.Urls.Count); Assert.AreEqual("detail", result.Urls.First().Type); Assert.AreEqual("http://marvel.com/comics/events/116/acts_of_vengeance?utm_campaign=apiRef&utm_source=20f18f98d97b8d7b9733fa6bdcfaea77", result.Urls.First().Value); Assert.AreEqual("wiki", result.Urls.Last().Type); Assert.AreEqual("http://marvel.com/universe/Acts_of_Vengeance!?utm_campaign=apiRef&utm_source=20f18f98d97b8d7b9733fa6bdcfaea77", result.Urls.Last().Value); Assert.AreEqual(new DateTimeOffset(new DateTime(2013, 6, 28, 16, 31, 24), new TimeSpan(-4, 0, 0)), result.Modified); Assert.AreEqual(new DateTime(1989, 12, 10), result.Start); Assert.AreEqual(new DateTime(2008, 1, 4), result.End); Assert.AreEqual("http://i.annihil.us/u/prod/marvel/i/mg/9/40/51ca10d996b8b", result.Thumbnail.Path); Assert.AreEqual("jpg", result.Thumbnail.Extension); Assert.AreEqual(117, result.Creators.Available); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/116/creators", result.Creators.CollectionUri); Assert.AreEqual(20, result.Creators.Items.Count); Assert.AreEqual("Jeff Albrecht", result.Creators.Items.First().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/creators/2707", result.Creators.Items.First().ResourceUri); Assert.AreEqual(null, result.Creators.Items.First().Type); Assert.AreEqual("inker", result.Creators.Items.First().Role); Assert.AreEqual("John Byrne", result.Creators.Items.Last().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/creators/1827", result.Creators.Items.Last().ResourceUri); Assert.AreEqual(null, result.Creators.Items.Last().Type); Assert.AreEqual("artist", result.Creators.Items.Last().Role); Assert.AreEqual(20, result.Creators.Returned); Assert.AreEqual(85, result.Characters.Available); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/116/characters", result.Characters.CollectionUri); Assert.AreEqual(20, result.Characters.Items.Count); Assert.AreEqual("Alpha Flight", result.Characters.Items.First().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/characters/1010370", result.Characters.Items.First().ResourceUri); Assert.AreEqual(null, result.Characters.Items.First().Type); Assert.AreEqual(null, result.Characters.Items.First().Role); Assert.AreEqual("Dazzler", result.Characters.Items.Last().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/characters/1009267", result.Characters.Items.Last().ResourceUri); Assert.AreEqual(null, result.Characters.Items.Last().Type); Assert.AreEqual(null, result.Characters.Items.Last().Role); Assert.AreEqual(20, result.Characters.Returned); Assert.AreEqual(145, result.Stories.Available); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/116/stories", result.Stories.CollectionUri); Assert.AreEqual(20, result.Stories.Items.Count); Assert.AreEqual("Cover #12960", result.Stories.Items.First().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/stories/12960", result.Stories.Items.First().ResourceUri); Assert.AreEqual("cover", result.Stories.Items.First().Type); Assert.AreEqual(null, result.Stories.Items.First().Role); Assert.AreEqual("Thieves Honor", result.Stories.Items.Last().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/stories/14921", result.Stories.Items.Last().ResourceUri); Assert.AreEqual("interiorStory", result.Stories.Items.Last().Type); Assert.AreEqual(null, result.Stories.Items.Last().Role); Assert.AreEqual(20, result.Stories.Returned); Assert.AreEqual(52, result.Comics.Available); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/116/comics", result.Comics.CollectionUri); Assert.AreEqual(20, result.Comics.Items.Count); Assert.AreEqual("Alpha Flight (1983) #79", result.Comics.Items.First().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/comics/12744", result.Comics.Items.First().ResourceUri); Assert.AreEqual(null, result.Comics.Items.First().Type); Assert.AreEqual(null, result.Comics.Items.First().Role); Assert.AreEqual("Doctor Strange, Sorcerer Supreme (1988) #11", result.Comics.Items.Last().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/comics/20170", result.Comics.Items.Last().ResourceUri); Assert.AreEqual(null, result.Comics.Items.Last().Type); Assert.AreEqual(null, result.Comics.Items.Last().Role); Assert.AreEqual(20, result.Comics.Returned); Assert.AreEqual(22, result.Series.Available); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/116/series", result.Series.CollectionUri); Assert.AreEqual(20, result.Series.Items.Count); Assert.AreEqual("Alpha Flight (1983 - 1994)", result.Series.Items.First().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/series/2116", result.Series.Items.First().ResourceUri); Assert.AreEqual(null, result.Series.Items.First().Type); Assert.AreEqual(null, result.Series.Items.First().Role); Assert.AreEqual("Web of Spider-Man (1985 - 1995)", result.Series.Items.Last().Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/series/2092", result.Series.Items.Last().ResourceUri); Assert.AreEqual(null, result.Series.Items.Last().Type); Assert.AreEqual(null, result.Series.Items.Last().Role); Assert.AreEqual(20, result.Series.Returned); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/240", result.Next.ResourceUri); Assert.AreEqual("Days of Future Present", result.Next.Name); Assert.AreEqual("http://gateway.marvel.com/v1/public/events/233", result.Previous.ResourceUri); Assert.AreEqual("Atlantis Attacks", result.Previous.Name); }
public void ChangeLocation(string eventString) { var e = EventParser.Parse(eventString, services); Engine.Instance.Push(e); }
public void Attack(string eventString) { var e = EventParser.Parse(eventString, services); Engine.Instance.Push(e); }