public void GetRouteTableForSubnetDetails() { // Setup cmdlet = new GetAzureRouteTable { Name = RouteTableName, CommandRuntime = mockCommandRuntime, Client = this.client, Detailed = new SwitchParameter(true) }; // Action cmdlet.ExecuteCmdlet(); // Assert networkingClientMock.Verify( c => c.Routes.GetRouteTableWithDetailsAsync( RouteTableName, NetworkClient.WithRoutesDetailLevel, It.IsAny <CancellationToken>()), Times.Once); Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count); Assert.IsType <RouteTableWithRoutes>(mockCommandRuntime.OutputPipeline.Single()); var routeTable = (RouteTableWithRoutes)(mockCommandRuntime.OutputPipeline.Single()); Assert.Equal(RouteTableName, routeTable.Name); Assert.Equal(RouteTableLabel, routeTable.Label); Assert.Equal(RouteTableLocation, routeTable.Location); Assert.NotEmpty(routeTable.Routes); Assert.Equal(Routes.First().Name, routeTable.Routes.First().Name); Assert.Equal(Routes.First().AddressPrefix, routeTable.Routes.First().AddressPrefix); Assert.Equal(Routes.First().NextHop.IpAddress, routeTable.Routes.First().NextHop.IpAddress); Assert.Equal(Routes.First().NextHop.Type, routeTable.Routes.First().NextHop.Type); }
public void GetRouteTableNoDetails() { // Setup cmdlet = new GetAzureRouteTable { Name = RouteTableName, CommandRuntime = mockCommandRuntime, Client = this.client }; // Action cmdlet.ExecuteCmdlet(); // Assert networkingClientMock.Verify( c => c.Routes.GetRouteTableWithDetailsAsync( RouteTableName, NetworkClient.WithoutRoutesDetailLevel, It.IsAny <CancellationToken>()), Times.Once); Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count); Assert.IsType <SimpleRouteTable>(mockCommandRuntime.OutputPipeline.Single()); var routeTable = (SimpleRouteTable)(mockCommandRuntime.OutputPipeline.Single()); Assert.Equal(RouteTableName, routeTable.Name); Assert.Equal(RouteTableLabel, routeTable.Label); Assert.Equal(RouteTableLocation, routeTable.Location); }