Example #1
0
        public void Should_include_the_prefix_snake_with_separator()
        {
            var formatter = new SnakeCaseEndpointNameFormatter("Dev-", false);

            var name = formatter.Consumer <SomeReallyCoolConsumer>();

            Assert.That(name, Is.EqualTo("dev-some_really_cool"));
        }
        public void Should_convert_to_snake_case_with_uppercase_ids()
        {
            var formatter = new SnakeCaseEndpointNameFormatter();

            var name = formatter.Consumer <SomeSuperIDFormatConsumer>();

            Assert.That(name, Is.EqualTo("some_super_idformat"));
        }
        public void Should_convert_to_snake_case_with_digits()
        {
            var formatter = new SnakeCaseEndpointNameFormatter();

            var name = formatter.Consumer <OneOr2MessageConsumer>();

            Assert.That(name, Is.EqualTo("one_or2_message"));
        }
        public void Should_convert_to_snake_case()
        {
            var formatter = new SnakeCaseEndpointNameFormatter();

            var name = formatter.Consumer <SomeReallyCoolConsumer>();

            Assert.That(name, Is.EqualTo("some_really_cool"));
        }
 public string GetEndpointName(IEndpointNameFormatter formatter)
 {
     string GetSeparator()
     {
         return(formatter switch
         {
             SnakeCaseEndpointNameFormatter f => f.Separator,
             _ => ""
         });
     }
        public string GetEndpointName(IEndpointNameFormatter formatter)
        {
            string FormatName()
            {
                return(string.IsNullOrWhiteSpace(_settings.Name)
                    ? FormatEndpointName(formatter)
                    : _settings.Name);
            }

            string GetSeparator()
            {
                return(formatter switch
                {
                    SnakeCaseEndpointNameFormatter f => f.Separator,
                    _ => ""
                });
            }