/// <summary>
        /// Creates a new NetGraphApplication instance.
        /// </summary>
        /// <param name="netProvider">
        /// Interface provided by API consumer that provides required networking infrastructure.
        /// </param>
        /// <param name="name">The user friendly name for this computer.</param>
        /// <param name="uri">The URI for this computer.</param>
        public NetGraphApplication(INetProvider netProvider, string name, Uri uri)
        {
            netProvider.AssertNotNull(nameof(netProvider));
            name.AssertNotNullOrEmptyOrWhitespace(nameof(netProvider));
            uri.AssertNotNull(nameof(uri));

            this.netProvider = netProvider;
            this.graph = new NetGraph(name, uri);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InMemoryServer"/> class.
        /// </summary>
        /// <param name="baseAddress">The base address.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="baseAddress"/> is <see langword="null"/>.
        /// </exception>
        public InMemoryServer(Uri baseAddress)
        {
            baseAddress.AssertNotNull("baseAddress");

            this.Configuration = new HttpConfiguration()
            {
                IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always
            };

            var server = new HttpServer(this.Configuration);

            this.Client = new HttpClient(new InMemoryHttpContentSerializationHandler(server), true)
            {
                BaseAddress = baseAddress
            };
        }
Example #3
0
        /// <summary>
        /// Creates the ThisNode NetNode object for this computer and verifies the inputs.
        /// </summary>
        /// <exception cref="ArgumentException">
        /// Thrown if name is null or empty.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// Thrown if the uri is null.
        /// </exception>
        /// <param name="name">A user friendly name for this computer.</param>
        /// <param name="uri">The uri to this computer, cannot be null.</param>
        /// <returns>A new node for the specified inputs.</returns>
        private static INetNode CreateAndVerifyThisNode(string name, Uri uri)
        {
            name.AssertNotNullOrEmptyOrWhitespace(nameof(name));
            uri.AssertNotNull(nameof(uri));

            return new NetNode(Guid.NewGuid(), name, uri, Enumerable.Empty<INetEdge>());
        }