コード例 #1
0
        public void CreateRouter()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier networkId = Guid.NewGuid();
                Identifier routerId  = Guid.NewGuid();
                httpTest.RespondWithJson(new Router {
                    Id = routerId, ExternalGateway = new ExternalGateway {
                        ExternalNetworkId = networkId
                    }
                });

                var definition = new RouterCreateDefinition();
                var result     = _networking.CreateRouter(definition);

                httpTest.ShouldHaveCalled("*/routers");
                Assert.NotNull(result);
                Assert.Equal(routerId, result.Id);
                Assert.Equal(networkId, result.ExternalGateway.ExternalNetworkId);
                Assert.IsType <NetworkingApiBuilder>(((IServiceResource)result).Owner);
            }
        }