This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using JetBrains.Annotations; | |
using Microsoft.AspNetCore.Mvc.Razor; | |
// These annotations make Resharper not complain about not finding the Views. | |
// ASP.NET Core support coming to R# for Feature Folders soon - https://youtrack.jetbrains.com/issue/RSRP-461882 | |
[assembly: AspMvcViewLocationFormat("/Features/{1}/{0}.cshtml")] | |
[assembly: AspMvcViewLocationFormat("/Features/Shared/{0}.cshtml")] | |
[assembly: AspMvcPartialViewLocationFormat("~/Features/{1}/{0}.cshtml")] | |
[assembly: AspMvcPartialViewLocationFormat("~/Features/Shared/{0}.cshtml")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: AspMvcViewLocationFormat("~/Features/{1}/{0}.cshtml")] | |
[assembly: AspMvcViewLocationFormat("~/Features/Shared/{0}.cshtml")] | |
[assembly: AspMvcPartialViewLocationFormat("~/Features/{1}/{0}.cshtml")] | |
[assembly: AspMvcPartialViewLocationFormat("~/Features/Shared/{0}.cshtml")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" Version="2.0.0" PrivateAssets="All" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> | |
{ | |
public DbSet<OrderItem> Orders { get; set; } | |
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } | |
protected override void OnModelCreating(ModelBuilder builder) | |
{ | |
base.OnModelCreating(builder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> | |
{ | |
public DbSet<OrderItem> OrderItems { get; set; } | |
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } | |
protected override void OnModelCreating(ModelBuilder builder) | |
{ | |
base.OnModelCreating(builder); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFrameworks>net461;netstandard20</TargetFrameworks> | |
<PackageVersion>1.0.0</PackageVersion> | |
<PackageId>Package Name</PackageId> | |
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | |
</PropertyGroup> | |
<ItemGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public IConfiguration Configuration { get; } | |
public IHostingEnvironment CurrentEnvironment { get; } | |
public Startup(IConfiguration configuration, IHostingEnvironment currentEnvironment) | |
{ | |
Configuration = configuration; | |
CurrentEnvironment = currentEnvironment; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Produces("application/json")] | |
[Route("api/ApplicationUsers")] | |
public class ApplicationUsersController : Controller | |
{ | |
private readonly ApplicationDbContext _context; | |
public ApplicationUsersController(ApplicationDbContext context) | |
{ | |
_context = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ApplicationUsersControllerGetApplicationUser | |
{ | |
private readonly ApplicationDbContext _context; | |
private readonly HttpClient _client; | |
public ApplicationUsersControllerGetApplicationUser() | |
{ | |
var builder = new WebHostBuilder() | |
.UseEnvironment("Testing") | |
.UseStartup<Startup>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task DoesReturnOk_GivenUserExists() | |
{ | |
// Arrange | |
var user = new ApplicationUser | |
{ | |
Id = "123", | |
Email = "test@test.com" | |
}; |