├── .gitignore ├── README.md ├── csharp-interview-prep.sln ├── lib ├── Class1.cs └── lib.csproj └── tests ├── UnitTest1.cs └── tests.csproj /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | packages 4 | .vscode 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Motivation: 2 | 3 | At Stripe, our interview process has some interviews where you write 4 | code, typically on your laptop. 5 | 6 | We've noticed that more often than not, we've had to spend a significant 7 | portion of the interview helping candidates setup a C# 8 | environment on their personal laptops. 9 | 10 | We've created a (rather ad-hoc) C# solution to help candidates 11 | determine if their laptops were setup to write C#, so interviews can 12 | be about evaluating the candidate, and not the way their environment is 13 | setup. 14 | 15 | # Getting Ready 16 | 17 | If you have not already, please install [.NET 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) 18 | 19 | This solution supports the following development environments. 20 | 21 | ## Console (Windows, Linux, OSX) 22 | in the directory of the repo run 23 | ```sh 24 | dotnet restore 25 | dotnet build 26 | dotnet test tests/ 27 | ``` 28 | 29 | If ```dotnet restore``` fails, is likely you are missing nuget.org feed. You can addit by following this instructions: [Adding Nuget.org](https://docs.microsoft.com/en-us/nuget/resources/nuget-faq#i-don-t-see-nuget-org-in-my-list-of-repositories--how-do-i-get-it-back-) 30 | 31 | ## Visual Studio Code (Windows, Linux, OSX) 32 | Open the directory of the repo 33 | 34 | Open the command palette 35 | 36 | Select `Tasks: Run Test Task` 37 | 38 | ## Visual Studio 2022 (Windows) 39 | Open `csharp-interview-prep.sln` 40 | 41 | Open Test Explorer 42 | 43 | Click `Run all` 44 | 45 | Ensure you can run and debug the included tests using your preferred environment. 46 | This project uses xUnit for implementing and executing tests. 47 | 48 | # About This Project: 49 | 50 | ## I prefer nUnit/Bespoke Powershell Scripts, do I need to use this? 51 | 52 | If you prefer different configuration files, that's awesome. 53 | Some interview questions may ask you to implement something from nothing, 54 | and some may want to watch you interact with a pre-existing codebase. 55 | For the former, it doesn't matter what you use, as long as you're able 56 | to get things setup quickly. 57 | 58 | Concerning the latter: xUnit is a common library for implementing unit 59 | tests in C#. 60 | Because of that, all pre-existing codebases we use in our interviews use 61 | xUnit. 62 | We aren't really specifically interested in how great your are at writing 63 | xUnit tests, but want you to quickly get them up and running. 64 | 65 | ## Useful References: 66 | - [.NET](https://dotnet.microsoft.com/) 67 | - [xUnit](https://xunit.github.io/) 68 | -------------------------------------------------------------------------------- /csharp-interview-prep.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8 5 | MinimumVisualStudioVersion = 17.8 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lib", "lib\lib.csproj", "{4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{25AA2B08-9560-4E59-A9DE-FF02B4E96406}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|x64.ActiveCfg = Debug|x64 26 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|x64.Build.0 = Debug|x64 27 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|x86.ActiveCfg = Debug|x86 28 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Debug|x86.Build.0 = Debug|x86 29 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|x64.ActiveCfg = Release|x64 32 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|x64.Build.0 = Release|x64 33 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|x86.ActiveCfg = Release|x86 34 | {4D8FEF9D-17A9-40B7-85A1-6D32ACCCB50F}.Release|x86.Build.0 = Release|x86 35 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|x64.ActiveCfg = Debug|x64 38 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|x64.Build.0 = Debug|x64 39 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|x86.ActiveCfg = Debug|x86 40 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Debug|x86.Build.0 = Debug|x86 41 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|x64.ActiveCfg = Release|x64 44 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|x64.Build.0 = Release|x64 45 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|x86.ActiveCfg = Release|x86 46 | {25AA2B08-9560-4E59-A9DE-FF02B4E96406}.Release|x86.Build.0 = Release|x86 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /lib/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace lib 5 | { 6 | public class Class1 7 | { 8 | public static void Main(string[] args) 9 | { 10 | Console.WriteLine("Hello world!"); 11 | } 12 | 13 | public string UseJsonNetForSomeReason(T input) 14 | { 15 | return JsonConvert.SerializeObject(input); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/lib.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net8.0 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/UnitTest1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | using lib; 4 | 5 | namespace tests 6 | { 7 | public class UnitTest1 8 | { 9 | [Fact] 10 | public void TestJsonNetForSomeReason() 11 | { 12 | var class1 = new Class1(); 13 | Assert.NotNull( 14 | class1.UseJsonNetForSomeReason( 15 | new 16 | { 17 | Intro = "Hello", 18 | Place = "World" 19 | } 20 | )); 21 | } 22 | 23 | [Fact] 24 | public void FailingTest() 25 | { 26 | Assert.True(false); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------