Skip to content

Instantly share code, notes, and snippets.

import React from "react";
import { screen, render, fireEvent } from "@testing-library/react";
import InputField from "./InputField";
import { Formik } from "formik";
test("should have validation error given input field is touched and error exists on form", () => {
const fieldName = "firstName";
const labelName = "First Name";
render(
<Formik
import React from "react";
import { Field } from "formik";
const InputField = (props) => {
return (
<Field name={props.fieldName}>
{({ field, form }) => (
<div>
<label htmlFor={props.fieldName}>{props.labelName}</label>
<input {...field} id={props.fieldName} type="text" />
namespace RazorHtmlEmails.RazorClassLib.Views.Emails.ConfirmAccount;
public record ConfirmAccountEmailViewModel(string ConfirmEmailUrl);
namespace RazorHtmlEmails.RazorClassLib.Views.Shared;
public record EmailButtonViewModel(string Text, string Url);
builder.Services.AddScoped<IRegisterAccountService, RegisterAccountService>();
builder.Services.AddScoped<IRazorViewToStringRenderer, RazorViewToStringRenderer>();
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;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewEngines;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Routing;
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using RazorHtmlEmails.Common;
namespace RazorHtmlEmails.AspNetCore.Pages;
public class IndexModel : PageModel
{
private readonly IRegisterAccountService _registerAccountService;
result.Should().Be(2);
Assert.Equal(2, result);