Main с таким синтаксическим сахаром упрощается и улучшается читаемость кода. Однако писать интеграционные тесты для таких сервисов становится сложнее — метод Main просто невозможно вызвать без лишних телодвижений. Недавно придумал относительно простое решение через рефлексию. 🇬🇧 Lately, I've been writing a lot of services that use top-level statements. The code with this kind of syntax sugar simplifies the
Main method and improves readability. However, on the other hand, it makes it more difficult to create integration tests for the services. There isn't simply way to call the Main method and pass the necessary arguments. Recently, I found a relatively simply solution using reflection.