public async void UpdatePortTest()
        {
            Network network = await _testData.CreateNetwork();

            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);
        }
Пример #2
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 = _networkingService.UpdatePort(portId, definition);

                httpTest.ShouldHaveCalled("*/ports/" + portId);
                Assert.NotNull(port);
                Assert.Equal(portId, port.Id);
            }
        }
        public async Task UpdatePortTest()
        {
            Network network = await _testData.CreateNetwork();
            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>();
 }
Пример #5
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 = _networkingService.UpdatePort(portId, definition);

                httpTest.ShouldHaveCalled("*/ports/" + portId);
                Assert.NotNull(port);
                Assert.Equal(portId, port.Id);
            }
        }
 /// <summary>
 /// Updates the specified port.
 /// </summary>
 /// <param name="networkingService">The networking service.</param>
 /// <param name="portId">The port identifier.</param>
 /// <param name="port">The updated port definition.</param>
 /// <returns>
 /// The updated port.
 /// </returns>
 public static Port UpdatePort(this NetworkingService networkingService, Identifier portId, PortUpdateDefinition port)
 {
     return networkingService.UpdatePortAsync(portId, port).ForceSynchronous();
 }