View RegisterAccountService.cs
using MailKit.Net.Smtp; | |
using MimeKit; | |
using MimeKit.Text; | |
using RazorHtmlEmails.RazorClassLib.Services; | |
using RazorHtmlEmails.RazorClassLib.Views.Emails.ConfirmAccount; | |
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace RazorHtmlEmails.Common |
View CalculatorServiceTests.cs
[Fact] | |
public void AddShouldSumNumbers() | |
{ | |
var result = CalculatorService.Add(1, 1); | |
result.Should().Be(3); | |
} |
View CalculatorServiceTests.cs
[Fact] | |
public void AddShouldSumNumbers() | |
{ | |
var result = CalculatorService.Add(1, 1); | |
Assert.Equal(3, result); | |
} |
View CalculatorServiceTests.cs
[Fact] | |
public void AddShouldSumNumbers() | |
{ | |
var result = CalculatorService.Add(1, 1); | |
Assert.True(result == 3); | |
} |
View WorkerService.csproj
<Project Sdk="Microsoft.NET.Sdk.Worker"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | |
</ItemGroup> |
View CounterTests.cs
public class CounterTests : TestContext | |
{ | |
[Fact] | |
public void ShouldIncrementCountWhenButtonIsClicked() | |
{ | |
var counterComponent = RenderComponent<Counter>(); | |
counterComponent.Find("button").Click(); | |
// Asserts actual user behavior |
View CounterTests.cs
public class CounterTests : TestContext | |
{ | |
[Fact] | |
public void ShouldIncrementCountWhenButtonIsClicked() | |
{ | |
var counterComponent = RenderComponent<Counter>(); | |
counterComponent.Find("button").Click(); | |
// This assertion tests that the state has incremented by 1 |
View Counter.razor
@page "/counter" | |
<h1>Counter</h1> | |
<p id="current-count">Current count: @CurrentCount</p> | |
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | |
@code { | |
public int CurrentCount { get; set; } |
View ConfigurationBuilderExample.cs
var configurationBuilder = new ConfigurationBuilder() | |
.AddJsonFile("appsettings.json") | |
.AddJsonFile($"appsettings.{Environment}.json"); | |
if (Environment.IsDevelopment()) | |
{ | |
configurationBuilder.AddUserSecrets(); | |
} | |
configurationBuilder.AddEnvironmentVariables(); |
View Index.cshtml.cs
[Authorize(PolicyName="Admin")] | |
public class IndexModel : PageModel | |
{ | |
public void OnGet() | |
{ | |
// do something | |
} | |
} |
NewerOlder