public void GivenBitcoinTestnet_ThenUseTheCorrectPort() { // Arrange. NodeSettings nodeSettings = NodeSettings.Default(Network.TestNet); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.TestBitcoinApiPort, settings.ApiPort); }
public void GivenApiPortIsProvided_ThenPortIsUsedWithDefaultApiUri() { // Arrange. int customPort = 55555; NodeSettings nodeSettings = new NodeSettings(args: new[] { $"-apiport={customPort}" }, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(customPort, settings.ApiPort); Assert.Equal(new Uri($"{ApiSettings.DefaultApiHost}:{customPort}"), settings.ApiUri); }
public void GivenStratisTestnet_ThenUseTheCorrectPort() { // Arrange. Transaction.TimeStamp = true; Block.BlockSignature = true; NodeSettings nodeSettings = NodeSettings.Default(Network.StratisTest); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.TestStratisApiPort, settings.ApiPort); }
public void GivenNoApiSettingsAreProvided_AndOnBitcoinNetwork_ThenDefaultSettingAreUsed() { // Arrange. Network network = Network.Main; NodeSettings nodeSettings = new NodeSettings(network, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.DefaultBitcoinApiPort, settings.ApiPort); Assert.Equal(new Uri($"{ApiSettings.DefaultApiHost}:{ApiSettings.DefaultBitcoinApiPort}"), settings.ApiUri); }
public void GivenApiUriIsProvided_AndGivenBitcoinNetwork_ThenApiUriIsUsedWithDefaultBitcoinApiPort() { // Arrange. string customApiUri = "http://0.0.0.0"; Network network = Network.Main; NodeSettings nodeSettings = new NodeSettings(network, args: new[] { $"-apiuri={customApiUri}" }, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.DefaultBitcoinApiPort, settings.ApiPort); Assert.Equal(new Uri($"{customApiUri}:{ApiSettings.DefaultBitcoinApiPort}"), settings.ApiUri); }
public void GivenNoApiSettingsAreProvided_AndOnStratisNetwork_ThenDefaultSettingAreUsed() { // Arrange. Transaction.TimeStamp = true; Block.BlockSignature = true; Network network = Network.StratisMain; NodeSettings nodeSettings = new NodeSettings(network, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.DefaultStratisApiPort, settings.ApiPort); Assert.Equal(new Uri($"{ApiSettings.DefaultApiHost}:{ApiSettings.DefaultStratisApiPort}"), settings.ApiUri); }
public void GivenApiUriIncludingPortIsProvided_ThenUseThePassedApiUri() { // Arrange. int customPort = 5522; string customApiUri = $"http://0.0.0.0:{customPort}"; Network network = Network.Main; NodeSettings nodeSettings = new NodeSettings(network, args: new[] { $"-apiuri={customApiUri}" }, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(customPort, settings.ApiPort); Assert.Equal(new Uri($"{customApiUri}"), settings.ApiUri); }
public void GivenApiUri_AndApiPortIsProvided_AndGivenBitcoinNetwork_ThenApiUriIsUsedWithApiPort() { // Arrange. string customApiUri = "http://0.0.0.0"; int customPort = 55555; Network network = Network.Main; NodeSettings nodeSettings = new NodeSettings("bitcoin", network).LoadArguments(new[] { $"-apiuri={customApiUri}", $"-apiport={customPort}" }); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(customPort, settings.ApiPort); Assert.Equal(new Uri($"{customApiUri}:{customPort}"), settings.ApiUri); }
public void GivenApiUriIsProvided_AndGivenStratisNetwork_ThenApiUriIsUsedWithDefaultStratisApiPort() { // Arrange. Transaction.TimeStamp = true; Block.BlockSignature = true; string customApiUri = "http://0.0.0.0"; Network network = Network.StratisMain; NodeSettings nodeSettings = new NodeSettings(network, args: new[] { $"-apiuri={customApiUri}" }, loadConfiguration: false); // Act. ApiSettings settings = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseApi() .Build() .NodeService <ApiSettings>(); settings.Load(nodeSettings); // Assert. Assert.Equal(ApiSettings.DefaultStratisApiPort, settings.ApiPort); Assert.Equal(new Uri($"{customApiUri}:{ApiSettings.DefaultStratisApiPort}"), settings.ApiUri); }