public static CreateFakeEvent ( ) : Microsoft.Azure.Insights.Models.EventData | ||
Résultat | Microsoft.Azure.Insights.Models.EventData |
public static void VerifyContinuationToken(EventDataListResponse response, Mock <IEventOperations> insinsightsEventOperationsMockightsClientMock, EventCmdletBase cmdlet) { // Make sure calls to Next work also response.EventDataCollection.NextLink = Utilities.ContinuationToken; var responseNext = new EventDataListResponse() { EventDataCollection = new EventDataCollection() { Value = new List <EventData>() { Utilities.CreateFakeEvent(), }, NextLink = null, }, RequestId = Guid.NewGuid().ToString(), StatusCode = HttpStatusCode.OK }; string nextToken = null; insinsightsEventOperationsMockightsClientMock.Setup(f => f.ListEventsNextAsync(It.IsAny <string>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <EventDataListResponse>(responseNext)) .Callback((string n, CancellationToken t) => nextToken = n); // Calling without optional parameters cmdlet.ExecuteCmdlet(); Assert.True(string.Equals(Utilities.ContinuationToken, nextToken, StringComparison.OrdinalIgnoreCase), "Incorrect continuation token"); }
public static AzureOperationResponse <LogProfileResource> InitializeLogProfileResponse() { // This is effectively testing the conversion EventData -> PSEventData internally in the execution of the cmdlet EventData eventData = Utilities.CreateFakeEvent(); var x = JsonConvert.SerializeObject(eventData); return(new AzureOperationResponse <LogProfileResource>() { Body = new LogProfileResource( name: Utilities.Name, location: "East US", id: "MyLogProfileId", locations: new string[] { "EastUs" }, categories: new List <string>() { "cat2" }, retentionPolicy: new RetentionPolicy(enabled: true, days: 10)) { ServiceBusRuleId = "myBusId", StorageAccountId = "myStorageAccId", Tags = null } }); }
public static AzureOperationResponse <IPage <EventData> > InitializeResponse() { // This is effectively testing the conversion EventData -> PSEventData internally in the execution of the cmdlet EventData eventData = Utilities.CreateFakeEvent(); var x = JsonConvert.SerializeObject(eventData); return(new AzureOperationResponse <IPage <EventData> >() { Body = JsonConvert.DeserializeObject <Azure.Insights.Models.Page <EventData> >(x) }); }
public static MetricDefinitionListResponse InitializeMetricDefinitionResponse() { // This is effectively testing the conversion EventData -> PSEventData internally in the execution of the cmdlet EventData eventData = Utilities.CreateFakeEvent(); return(new MetricDefinitionListResponse { MetricDefinitionCollection = new MetricDefinitionCollection { Value = new MetricDefinition[] {} }, RequestId = Guid.NewGuid().ToString(), StatusCode = HttpStatusCode.OK }); }
public static EventDataListResponse InitializeResponse() { // This is effectively testing the conversion EventData -> PSEventData internally in the execution of the cmdlet EventData eventData = Utilities.CreateFakeEvent(); return(new EventDataListResponse() { EventDataCollection = new EventDataCollection() { Value = new List <EventData>() { eventData, }, NextLink = null, }, RequestId = Guid.NewGuid().ToString(), StatusCode = HttpStatusCode.OK }); }