public void with_config() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/invalid_format_config.yaml"); var args = new string[] { "-config", configFile }; Assert.Throws <OptionException>(() => { EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); }); }
public void name_is_set() { var checksum = new WriteThroughFileCheckpoint(HelperExtensions.GetFilePathFromAssembly("filename"), "test"); Assert.AreEqual("test", checksum.Name); checksum.Close(); }
public void should_warn_the_user_about_unknown_argument_when_from_config_file() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config_with_unknown_option.yaml"); var args = new string[] { "-config", configFile }; var optionException = Assert.Throws <OptionException>(() => { EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); }); Assert.True(optionException.Message.Contains("UnknownOption")); }
public override void Given() { var certificate = HelperExtensions.GetFilePathFromAssembly(Path.Combine("TestCertificates", "certificate.pem")); var privateKey = HelperExtensions.GetFilePathFromAssembly(Path.Combine("TestCertificates", "private.key")); _builder.WithServerCertificateFromFile(certificate, privateKey, string.Empty); }
public override void Given() { var certificateWithPassword = HelperExtensions.GetFilePathFromAssembly(Path.Combine("TestCertificates", "public_and_private_with_password.p12")); _builder.WithServerCertificateFromFile(certificateWithPassword, string.Empty, "changeit"); }
public void should_use_the_argument_over_the_config_file_value() { var configPath = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config.yaml"); var args = new string[] { "-config", configPath, "-log", "~/customLogsDirectory" }; var testArgs = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual("~/customLogsDirectory", testArgs.Log); }
public void should_use_the_config_file_value() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config.yaml"); var args = new string[] { "-config", configFile }; var testArgs = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual("~/logDirectoryFromConfigFile", testArgs.Log); }
public void should_be_able_to_parse_the_option_ignoring_casing() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config_with_incorrectly_cased_option.yaml"); var args = new string[] { "-config", configFile }; var options = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual("~/gesLogs", options.Log); Assert.AreEqual(ProjectionType.All, options.RunProjections); }
public void should_be_able_to_parse_the_value_from_a_config_file() { var args = new string[] { "-config", HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config.yaml") }; var testArgs = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual(new IPEndPoint[] { new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1000), new IPEndPoint(IPAddress.Parse("127.0.0.2"), 2000) }, testArgs.GossipSeed); }
public void should_use_the_command_line_argument() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config.yaml"); Environment.SetEnvironmentVariable(String.Format("{0}HTTP_PORT", Opts.EnvPrefix), "2111", EnvironmentVariableTarget.Process); var args = new string[] { "-config", configFile, "-httpPort", "2115" }; var testArgs = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual(2115, testArgs.HttpPort); Environment.SetEnvironmentVariable(String.Format("{0}HTTP_PORT", Opts.EnvPrefix), null, EnvironmentVariableTarget.Process); }
public void should_use_the_environment_variable_over_the_config_value() { var configFile = HelperExtensions.GetFilePathFromAssembly("TestConfigs/test_config.yaml"); Environment.SetEnvironmentVariable(String.Format("{0}HTTP_PORT", Opts.EnvPrefix), "2111"); var args = new string[] { "-config", configFile }; var testArgs = EventStoreOptions.Parse <TestArgs>(args, Opts.EnvPrefix); Assert.AreEqual(2111, testArgs.HttpPort); Environment.SetEnvironmentVariable(String.Format("{0}HTTP_PORT", Opts.EnvPrefix), String.Empty); }
protected override void Given() { var request = CreateRequest(TestStream, String.Empty, HttpMethod.Post, "application/octet-stream"); request.Headers.Add("ES-EventType", "TestEventType"); request.Headers.Add("ES-EventID", Guid.NewGuid().ToString()); if (_data == null) { var fileData = HelperExtensions.GetFilePathFromAssembly("Resources/es-tile.png"); _data = File.ReadAllBytes(fileData); } request.ContentLength = _data.Length; request.GetRequestStream().Write(_data, 0, _data.Length); _response = GetRequestResponse(request); Assert.AreEqual(HttpStatusCode.Created, _response.StatusCode); }
protected override async Task Given() { var request = CreateRequest(TestStream, String.Empty, HttpMethod.Post, "application/octet-stream"); request.Headers.Add("ES-EventType", "TestEventType"); request.Headers.Add("ES-EventID", Guid.NewGuid().ToString()); if (_data == null) { var fileData = HelperExtensions.GetFilePathFromAssembly("Resources/es-tile.png"); _data = File.ReadAllBytes(fileData); } request.Content = new ByteArrayContent(_data) { Headers = { ContentType = new MediaTypeHeaderValue("application/octet-stream") } }; _response = await GetRequestResponse(request); Assert.AreEqual(HttpStatusCode.Created, _response.StatusCode); }