Compare commits

...

2 commits

Author SHA1 Message Date
Daniel Siepmann fe824ac4cf
Add csharp 2024-03-26 07:12:00 +01:00
Daniel Siepmann 0ae78186e8
Remove .exercism/metadata.json files 2024-03-26 07:11:40 +01:00
39 changed files with 273 additions and 30 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
/exercism
*/*/.exercism/metadata.json

View file

@ -1 +0,0 @@
{"track":"c","exercise":"armstrong-numbers","id":"60d246ac49a6440fbb0070237e7fa91c","url":"https://exercism.org/tracks/c/exercises/armstrong-numbers","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"c","exercise":"grade-school","id":"bbd61a502b974d5da52e7b0902c2ecdc","url":"https://exercism.org/tracks/c/exercises/grade-school","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"c","exercise":"hello-world","id":"13bb65babfbf488da1341c7cf6eb8631","url":"https://exercism.org/tracks/c/exercises/hello-world","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"c","exercise":"high-scores","id":"92429e05d2c649a98e5ea020a25cf650","url":"https://exercism.org/tracks/c/exercises/high-scores","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"c","exercise":"isogram","id":"1e7523eb1a154f499fed7026d5c5eed2","url":"https://exercism.org/tracks/c/exercises/isogram","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"c","exercise":"reverse-string","id":"cc2f15d6d3a44a8e8b110aadbc4948eb","url":"https://exercism.org/tracks/c/exercises/reverse-string","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

2
csharp/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*/bin/
*/obj/

View file

@ -0,0 +1,141 @@
###############################
# Core EditorConfig Options #
###############################
; This file is for unifying the coding style for different editors and IDEs.
; More information at:
; https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017
; https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017
root = true
[*]
indent_style = space
[HelloWorld.cs]
indent_size = 4
###############################
# .NET Coding Conventions #
###############################
# Organize usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = true
# this. preferences
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
# Modifier preferences
dotnet_style_require_accessibility_modifiers = always:suggestion
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Code Style Rules #
###############################
# var preferences
csharp_style_var_for_built_in_types = true:none
csharp_style_var_when_type_is_apparent = true:none
csharp_style_var_elsewhere = true:none
# Expression-bodied members
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:suggestion
csharp_style_expression_bodied_operators = true:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
# Pattern-matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:none
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

View file

@ -0,0 +1,26 @@
{
"authors": [
"robkeim"
],
"contributors": [
"ErikSchierboom",
"j2jensen"
],
"files": {
"solution": [
"HelloWorld.cs"
],
"test": [
"HelloWorldTests.cs"
],
"example": [
".meta/Example.cs"
],
"invalidator": [
"HelloWorld.csproj"
]
},
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
"source": "This is an exercise to introduce users to using Exercism",
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
}

View file

@ -0,0 +1,39 @@
# Help
## Running the tests
You can run the tests by opening a command prompt in the exercise's directory, and then running the [`dotnet test` command](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test)
Alternatively, most IDE's have built-in support for running tests, including [Visual Studio](https://docs.microsoft.com/en-us/visualstudio/test/run-unit-tests-with-test-explorer), [Rider](https://www.jetbrains.com/help/rider/Unit_Testing_in_Solution.html) and [Visual Studio code](https://github.com/OmniSharp/omnisharp-vscode/wiki/How-to-run-and-debug-unit-tests).
See the [tests page](https://exercism.org/docs/tracks/csharp/tests) for more information.
## Skipped tests
Initially, only the first test will be enabled.
This is to encourage you to solve the exercise one step at a time.
Once you get the first test passing, remove the `Skip` property from the next test and work on getting that test passing.
## Submitting your solution
You can submit your solution using the `exercism submit HelloWorld.cs` command.
This command will upload your solution to the Exercism website and print the solution page's URL.
It's possible to submit an incomplete solution which allows you to:
- See how others have completed the exercise
- Request help from a mentor
## Need to get help?
If you'd like help solving the exercise, check the following pages:
- The [C# track's documentation](https://exercism.org/docs/tracks/csharp)
- The [C# track's programming category on the forum](https://forum.exercism.org/c/programming/csharp)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
To get help if you're having trouble, you can use one of the following resources:
- [/r/csharp](https://www.reddit.com/r/csharp) is the C# subreddit.
- [StackOverflow](http://stackoverflow.com/questions/tagged/c%23) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.

View file

@ -0,0 +1,4 @@
public static class HelloWorld
{
public static string Hello() => "Hello, World!";
}

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="Exercism.Tests" Version="0.1.0-beta1" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,10 @@
using Xunit;
public class HelloWorldTests
{
[Fact]
public void Say_hi_()
{
Assert.Equal("Hello, World!", HelloWorld.Hello());
}
}

View file

@ -0,0 +1,36 @@
# Hello World
Welcome to Hello World on Exercism's C# Track.
If you need help running the tests or submitting your code, check out `HELP.md`.
## Instructions
The classical introductory exercise.
Just say "Hello, World!".
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
The objectives are simple:
- Modify the provided code so that it produces the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.
If everything goes well, you will be ready to fetch your first real exercise.
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
## Source
### Created by
- @robkeim
### Contributed to by
- @ErikSchierboom
- @j2jensen
### Based on
This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program

View file

@ -1 +0,0 @@
{"track":"go","exercise":"hello-world","id":"eb8d02cbc5514a39b18dd8500a96ef7d","url":"https://exercism.org/tracks/go/exercises/hello-world","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"go","exercise":"lasagna","id":"520c741b507a484ba5da65b0e5a6a0da","url":"https://exercism.org/tracks/go/exercises/lasagna","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"lua","exercise":"cars-assemble","id":"3f99bf413f25427fac033beddcbc43dc","url":"https://exercism.org/tracks/lua/exercises/cars-assemble","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"lua","exercise":"hello-world","id":"2d3833370241493e8a856594b3145ffb","url":"https://exercism.org/tracks/lua/exercises/hello-world","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"lua","exercise":"lasagna","id":"445a4b45ea9943a0b4af6aacafccecf1","url":"https://exercism.org/tracks/lua/exercises/lasagna","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"lua","exercise":"pacman-rules","id":"0d1d1dfb88a146f3914493ec957008ee","url":"https://exercism.org/tracks/lua/exercises/pacman-rules","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"armstrong-numbers","id":"2a80ef9a5a4d4cd3ab33146185340837","url":"https://exercism.org/tracks/python/exercises/armstrong-numbers","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"black-jack","id":"1717580736c8411a9af5b913da36035f","url":"https://exercism.org/tracks/python/exercises/black-jack","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"bob","id":"43ba401157eb4fbdbe509c56987c49c3","url":"https://exercism.org/tracks/python/exercises/bob","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"collatz-conjecture","id":"8dd5b1da6ffe48fd84ebb215294b5945","url":"https://exercism.org/tracks/python/exercises/collatz-conjecture","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"currency-exchange","id":"07d39586b50c46b88bf8e7cd530d2b5b","url":"https://exercism.org/tracks/python/exercises/currency-exchange","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"ghost-gobble-arcade-game","id":"cd4b58bb31f84a529f8fbfd52a7cf380","url":"https://exercism.org/tracks/python/exercises/ghost-gobble-arcade-game","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"grains","id":"11361381ca01412ab4218ec24ada6139","url":"https://exercism.org/tracks/python/exercises/grains","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"guidos-gorgeous-lasagna","id":"60b90719a4944b33a085d5c8c6d835bd","url":"https://exercism.org/tracks/python/exercises/guidos-gorgeous-lasagna","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"hello-world","id":"ba191b6f92d84b57a427fa154fe6e6eb","url":"https://exercism.org/tracks/python/exercises/hello-world","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"leap","id":"fd4b50a0ebbe49dc8e0b0c15b5551cfc","url":"https://exercism.org/tracks/python/exercises/leap","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"little-sisters-vocab","id":"67360f1a7adb4d37ab110d2e3d1dc2fc","url":"https://exercism.org/tracks/python/exercises/little-sisters-vocab","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"meltdown-mitigation","id":"4b91cf86ba56457fb003c8c9681fff64","url":"https://exercism.org/tracks/python/exercises/meltdown-mitigation","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"pig-latin","id":"3f746fd8371241dca8d222d21db49a7b","url":"https://exercism.org/tracks/python/exercises/pig-latin","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"raindrops","id":"00ec103661614e07b410af1f21c48a65","url":"https://exercism.org/tracks/python/exercises/raindrops","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"python","exercise":"triangle","id":"0cf58530790e46efaaeaed5ed8256e34","url":"https://exercism.org/tracks/python/exercises/triangle","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"rust","exercise":"gigasecond","id":"bab817c2728943b8b80333d1c22c2ab1","url":"https://exercism.org/tracks/rust/exercises/gigasecond","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"rust","exercise":"hello-world","id":"f0bf2083fc314cb88a1cb31a4e806a10","url":"https://exercism.org/tracks/rust/exercises/hello-world","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}

View file

@ -1 +0,0 @@
{"track":"rust","exercise":"reverse-string","id":"784937180a8049f5946367600b1c6d4f","url":"https://exercism.org/tracks/rust/exercises/reverse-string","handle":"DanielSiepmann","is_requester":true,"auto_approve":false}