diff --git a/dot-net-core/.gitignore b/dot-net-core/.gitignore new file mode 100644 index 00000000..7b5962a8 --- /dev/null +++ b/dot-net-core/.gitignore @@ -0,0 +1,240 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +bin/ +Bin/ +obj/ +Obj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# OpenCover +**/coverage/** + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +orleans.codegen.cs + +/node_modules + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ + +# VS Code +.vscode/ + +# OpenCover +coverage/ \ No newline at end of file diff --git a/dot-net-core/Interviews.sln b/dot-net-core/Interviews.sln new file mode 100644 index 00000000..a0a14510 --- /dev/null +++ b/dot-net-core/Interviews.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interviews", "src\Interviews.csproj", "{FE1EC190-7EAA-41C7-8A24-EB3E050B3644}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interviews.Tests", "test\Interviews.Tests.csproj", "{AE33A974-69F2-40B7-8489-A4C697582EBC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|x64.ActiveCfg = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|x64.Build.0 = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|x86.ActiveCfg = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Debug|x86.Build.0 = Debug|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|Any CPU.Build.0 = Release|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|x64.ActiveCfg = Release|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|x64.Build.0 = Release|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|x86.ActiveCfg = Release|Any CPU + {FE1EC190-7EAA-41C7-8A24-EB3E050B3644}.Release|x86.Build.0 = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|x64.ActiveCfg = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|x64.Build.0 = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|x86.ActiveCfg = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Debug|x86.Build.0 = Debug|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|Any CPU.Build.0 = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|x64.ActiveCfg = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|x64.Build.0 = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|x86.ActiveCfg = Release|Any CPU + {AE33A974-69F2-40B7-8489-A4C697582EBC}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/dot-net-core/README.md b/dot-net-core/README.md new file mode 100644 index 00000000..98d01a55 --- /dev/null +++ b/dot-net-core/README.md @@ -0,0 +1,9 @@ +# .NET Coding Challenges + +Microsoft .NET based at home tests for engineering interviews. + +Steps: + +- Fork this repo +- Modify the code as described in the README.md files inside the src and test folders. +- Send a pull request for your fork when you consider the assignment complete. \ No newline at end of file diff --git a/dot-net-core/src/DbContexts/ApplicationDbContext.cs b/dot-net-core/src/DbContexts/ApplicationDbContext.cs new file mode 100644 index 00000000..5807d039 --- /dev/null +++ b/dot-net-core/src/DbContexts/ApplicationDbContext.cs @@ -0,0 +1,17 @@ +using Interview.Entities; +using Microsoft.EntityFrameworkCore; + +namespace Interviews.DbContexts +{ + public class ApplicationDbContext : DbContext + { + public virtual DbSet Users { get; set; } + + public virtual DbSet Lessons { get; set; } + + public ApplicationDbContext(DbContextOptions options) + : base(options) + { + } + } +} \ No newline at end of file diff --git a/dot-net-core/src/Entities/BaseEntity.cs b/dot-net-core/src/Entities/BaseEntity.cs new file mode 100644 index 00000000..a53fa4e9 --- /dev/null +++ b/dot-net-core/src/Entities/BaseEntity.cs @@ -0,0 +1,13 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Interview.Entities +{ + public class BaseEntity + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/dot-net-core/src/Entities/LessonEntity.cs b/dot-net-core/src/Entities/LessonEntity.cs new file mode 100644 index 00000000..dea23212 --- /dev/null +++ b/dot-net-core/src/Entities/LessonEntity.cs @@ -0,0 +1,6 @@ +namespace Interview.Entities +{ + public class LessonEntity : BaseEntity + { + } +} \ No newline at end of file diff --git a/dot-net-core/src/Entities/UserEntity.cs b/dot-net-core/src/Entities/UserEntity.cs new file mode 100644 index 00000000..4b719a38 --- /dev/null +++ b/dot-net-core/src/Entities/UserEntity.cs @@ -0,0 +1,6 @@ +namespace Interview.Entities +{ + public class UserEntity : BaseEntity + { + } +} \ No newline at end of file diff --git a/dot-net-core/src/Interviews.csproj b/dot-net-core/src/Interviews.csproj new file mode 100644 index 00000000..95accf36 --- /dev/null +++ b/dot-net-core/src/Interviews.csproj @@ -0,0 +1,11 @@ + + + + Exe + netcoreapp2.2 + + + + + + diff --git a/dot-net-core/src/Program.cs b/dot-net-core/src/Program.cs new file mode 100644 index 00000000..8e0ca213 --- /dev/null +++ b/dot-net-core/src/Program.cs @@ -0,0 +1,50 @@ +using System; +using Interviews.Services; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Interviews +{ + class Program + { + static void Main(string[] args) + { + var services = BuildServiceProvider(args); + + var logger = services.GetRequiredService>(); + logger.LogDebug("Starting application"); + + // coordinates test execution + var testService = services.GetService(); + + // step 1 + testService.ExecuteStep1(); + + // step 2 + testService.ExecuteStep2(); + + // step 3 + testService.ExecuteStep3(); + + // step 4 + testService.ExecuteStep4(); + + logger.LogDebug("All done!"); + + // needed to get the logger to flush + services.Dispose(); + } + + public static ServiceProvider BuildServiceProvider(string[] args) => + // setup our DI + new ServiceCollection() + .AddLogging((logging) => + { + // configure console logging + logging.AddConsole(); + logging.SetMinimumLevel(LogLevel.Debug); + }) + .AddSingleton() + .BuildServiceProvider(); + } +} diff --git a/dot-net-core/src/README.md b/dot-net-core/src/README.md new file mode 100644 index 00000000..083ab547 --- /dev/null +++ b/dot-net-core/src/README.md @@ -0,0 +1,10 @@ +# .NET Coding and Thinking Challenges + +Application Development. + +Steps: + +- Take a few minutes to familiarize yourself with the application setup +- The application uses an in-memory database for data storage +- Fill out the execution for each step in the Test Service class +- Make convention or best-practice changes as needed to get this app production-ready \ No newline at end of file diff --git a/dot-net-core/src/Repositories/ILessonRepository.cs b/dot-net-core/src/Repositories/ILessonRepository.cs new file mode 100644 index 00000000..2639c015 --- /dev/null +++ b/dot-net-core/src/Repositories/ILessonRepository.cs @@ -0,0 +1,7 @@ +namespace Interviews.Repositories +{ + public interface ILessonRepository + { + void CreateLesson(string lesson); + } +} diff --git a/dot-net-core/src/Repositories/IUserRepository.cs b/dot-net-core/src/Repositories/IUserRepository.cs new file mode 100644 index 00000000..e9b7900a --- /dev/null +++ b/dot-net-core/src/Repositories/IUserRepository.cs @@ -0,0 +1,7 @@ +namespace Interviews.Repositories +{ + public interface IUserRepository + { + void CreateUser(string user); + } +} diff --git a/dot-net-core/src/Repositories/LessonRepository.cs b/dot-net-core/src/Repositories/LessonRepository.cs new file mode 100644 index 00000000..b14b4d3c --- /dev/null +++ b/dot-net-core/src/Repositories/LessonRepository.cs @@ -0,0 +1,24 @@ +using System; +using Interviews.DbContexts; +using Microsoft.EntityFrameworkCore; + +namespace Interviews.Repositories +{ + public class LessonRepository : ILessonRepository + { + private readonly ApplicationDbContext _applicationDbContext; + + public LessonRepository() + { + var options = new DbContextOptionsBuilder() + .UseInMemoryDatabase("ApplicationDatabase") + .Options; + + _applicationDbContext = new ApplicationDbContext(options); + } + + public void CreateLesson(string lesson) + { + } + } +} diff --git a/dot-net-core/src/Repositories/UserRepository.cs b/dot-net-core/src/Repositories/UserRepository.cs new file mode 100644 index 00000000..17436e42 --- /dev/null +++ b/dot-net-core/src/Repositories/UserRepository.cs @@ -0,0 +1,24 @@ +using System; +using Interviews.DbContexts; +using Microsoft.EntityFrameworkCore; + +namespace Interviews.Repositories +{ + public class UserRepository : IUserRepository + { + private readonly ApplicationDbContext _applicationDbContext; + + public UserRepository() + { + var options = new DbContextOptionsBuilder() + .UseInMemoryDatabase("ApplicationDatabase") + .Options; + + _applicationDbContext = new ApplicationDbContext(options); + } + + public void CreateUser(string user) + { + } + } +} \ No newline at end of file diff --git a/dot-net-core/src/Services/AssignmentService.cs b/dot-net-core/src/Services/AssignmentService.cs new file mode 100644 index 00000000..a2a805b4 --- /dev/null +++ b/dot-net-core/src/Services/AssignmentService.cs @@ -0,0 +1,10 @@ +namespace Interviews.Services +{ + public class AssignmentService + { + public void AssignLesson(string user, string lesson) + { + + } + } +} \ No newline at end of file diff --git a/dot-net-core/src/Services/IAssignmentService.cs b/dot-net-core/src/Services/IAssignmentService.cs new file mode 100644 index 00000000..83589883 --- /dev/null +++ b/dot-net-core/src/Services/IAssignmentService.cs @@ -0,0 +1,7 @@ +namespace Interviews.Services +{ + public interface IAssignmentService + { + void AssignLesson(string user, string lesson); + } +} \ No newline at end of file diff --git a/dot-net-core/src/Services/ITestService.cs b/dot-net-core/src/Services/ITestService.cs new file mode 100644 index 00000000..ed311ecf --- /dev/null +++ b/dot-net-core/src/Services/ITestService.cs @@ -0,0 +1,13 @@ +namespace Interviews.Services +{ + public interface ITestService + { + void ExecuteStep1(); + + void ExecuteStep2(); + + void ExecuteStep3(); + + void ExecuteStep4(); + } +} \ No newline at end of file diff --git a/dot-net-core/src/Services/TestService.cs b/dot-net-core/src/Services/TestService.cs new file mode 100644 index 00000000..0c32890a --- /dev/null +++ b/dot-net-core/src/Services/TestService.cs @@ -0,0 +1,27 @@ +using Interviews.Repositories; + +namespace Interviews.Services +{ + public class TestService : ITestService + { + public void ExecuteStep1() + { + // create a user + } + + public void ExecuteStep2() + { + // create a lesson + } + + public void ExecuteStep3() + { + // assign the lesson to the user + } + + public void ExecuteStep4() + { + // verify lesson is assigned + } + } +} \ No newline at end of file diff --git a/dot-net-core/test/Interviews.Tests.csproj b/dot-net-core/test/Interviews.Tests.csproj new file mode 100644 index 00000000..5cd063fa --- /dev/null +++ b/dot-net-core/test/Interviews.Tests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp2.2 + + false + + + + + + + + + + + + + diff --git a/dot-net-core/test/README.md b/dot-net-core/test/README.md new file mode 100644 index 00000000..7d203c47 --- /dev/null +++ b/dot-net-core/test/README.md @@ -0,0 +1,10 @@ +# .NET Coding and Thinking Challenges + +Unit Testing. + +Steps: + +- Take a few minutes to familiarize yourself with the unit test setup +- The tests use an in-memory database for data storage +- Add the unit tests requested in the test files +- Add any additional unit tests as needed to increase code coverage \ No newline at end of file diff --git a/dot-net-core/test/Repositories/LessonRepositoryTests.cs b/dot-net-core/test/Repositories/LessonRepositoryTests.cs new file mode 100644 index 00000000..b84e66d6 --- /dev/null +++ b/dot-net-core/test/Repositories/LessonRepositoryTests.cs @@ -0,0 +1,7 @@ +namespace Interview.Tests.Repositories +{ + public class LessonRepositoryTests + { + // verify that lesson is created + } +} \ No newline at end of file diff --git a/dot-net-core/test/Repositories/UserRepositoryTests.cs b/dot-net-core/test/Repositories/UserRepositoryTests.cs new file mode 100644 index 00000000..c5ed2239 --- /dev/null +++ b/dot-net-core/test/Repositories/UserRepositoryTests.cs @@ -0,0 +1,7 @@ +namespace Interview.Tests.Repositories +{ + public class UserRepositoryTests + { + // verify that user is created + } +} \ No newline at end of file diff --git a/dot-net-core/test/Services/AssignmentServiceTests.cs b/dot-net-core/test/Services/AssignmentServiceTests.cs new file mode 100644 index 00000000..de8ff83b --- /dev/null +++ b/dot-net-core/test/Services/AssignmentServiceTests.cs @@ -0,0 +1,7 @@ +namespace Interview.Tests.Services +{ + public class AssignmentServiceTests + { + // verify that user is assigned the lesson + } +} \ No newline at end of file