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 DoesReturnNotFound_GivenUserDoesNotExist() | |
{ | |
// Act | |
var response = await _client.GetAsync($"/api/ApplicationUsers/abc"); // No users with ID abc | |
// Assert | |
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); | |
} |
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
public class PostConfig : IEntityTypeConfiguration<Post> | |
{ | |
public void Configure(EntityTypeBuilder<Post> builder) | |
{ | |
builder.HasOne(p => p.Blog) | |
.WithOne(b => b.Posts) | |
.HasForeignKey(p => p.BlogId) | |
.HasConstraintName("ForeignKey_Post_Blog"); | |
} | |
} |
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 FakeUrlHelper : IUrlHelper | |
{ | |
public string Action(UrlActionContext actionContext) | |
{ | |
return ""; | |
} | |
public string Content(string contentPath) | |
{ | |
return ""; |
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 async Task<IActionResult> OnPostAsync(string returnUrl = null) | |
{ | |
ReturnUrl = returnUrl; | |
if (!ModelState.IsValid) | |
return Page(); | |
var user = new ApplicationUser { UserName = Input.Email, Email = Input.Email }; | |
var result = await _userManager.CreateAsync(user, Input.Password); |
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
"minify": { | |
"enabled": true, | |
"renameLocals": true | |
}, | |
"sourceMap": false |
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
[ | |
{ | |
"outputFileName": "wwwroot/js/site.min.js", | |
"inputFiles": [ | |
"wwwroot/js/site.js" | |
], | |
"minify": { | |
"enabled": true, | |
"renameLocals": true | |
}, |
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
[ | |
{ | |
"outputFileName": "wwwroot/js/site.min.js", | |
"inputFiles": [ | |
"wwwroot/js/site.js" | |
] | |
} | |
] |
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 void ConfigureServices(IServiceCollection services) | |
{ | |
services.Configure<PasswordHasherOptions>(options => options.IterationCount = 100_000); | |
// Note: the number 100,000 is not a formal recommendation. Test the performance of your login page before changing this. | |
// Do what makes sense for your application, the hardware it runs on, and the hardware climate at the time when you read this. | |
// Other entries remove for brevity. | |
} |