Пример #1
0
        public void UpdatePort()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier portId = Guid.NewGuid();
                httpTest.RespondWithJson(new Port {
                    Id = portId
                });

                var definition = new PortUpdateDefinition {
                    Name = "new subnet name"
                };
                var port = _cloudNetworkService.UpdatePort(portId, definition);

                httpTest.ShouldHaveCalled("*/ports/" + portId);
                Assert.NotNull(port);
                Assert.Equal(portId, port.Id);
            }
        }
        public async void UpdatePortTest()
        {
            Network network = await _testData.CreateNetwork();

            var subnet = await _testData.CreateSubnet(network);

            Port port = await _testData.CreatePort(network);

            var portUpdate = new PortUpdateDefinition
            {
                Name = string.Format("{0}-updated", port.Name)
            };

            Trace.WriteLine("Updating the port...");
            port = await _networkingService.UpdatePortAsync(port.Id, portUpdate);

            Trace.WriteLine("Verifying port was updated as requested...");
            Assert.NotNull(port);
            Assert.Equal(portUpdate.Name, port.Name);
        }
 /// <inheritdoc cref="NetworkingApiBuilder.UpdatePortAsync" />
 public Task<Port> UpdatePortAsync(Identifier portId, PortUpdateDefinition port, CancellationToken cancellationToken = default(CancellationToken))
 {
     return _networkingApiBuilder
         .UpdatePortAsync(portId, port, cancellationToken)
         .SendAsync()
         .ReceiveJson<Port>();
 }
        public async void UpdatePortTest()
        {
            Network network = await _testData.CreateNetwork();
            var subnet = await _testData.CreateSubnet(network);
            Port port = await _testData.CreatePort(network);

            var portUpdate = new PortUpdateDefinition
            {
                Name = string.Format("{0}-updated", port.Name)
            };

            Trace.WriteLine("Updating the port...");
            port = await _networkingService.UpdatePortAsync(port.Id, portUpdate);

            Trace.WriteLine("Verifying port was updated as requested...");
            Assert.NotNull(port);
            Assert.Equal(portUpdate.Name, port.Name);
        }
 /// <inheritdoc cref="OpenStack.Synchronous.NetworkingServiceExtensions.UpdatePort"/>
 public static Port UpdatePort(this CloudNetworkService cloudNetworkService, Identifier portId, PortUpdateDefinition port)
 {
     return cloudNetworkService.UpdatePortAsync(portId, port).ForceSynchronous();
 }
Пример #6
0
        public void UpdatePort()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier portId = Guid.NewGuid();
                httpTest.RespondWithJson(new Port { Id = portId });

                var definition = new PortUpdateDefinition { Name = "new subnet name" };
                var port = _cloudNetworkService.UpdatePort(portId, definition);

                httpTest.ShouldHaveCalled("*/ports/" + portId);
                Assert.NotNull(port);
                Assert.Equal(portId, port.Id);
            }
        }