Skip to content

Commit

Permalink
Update tests broken by basic spam blocking in aeb62e0
Browse files Browse the repository at this point in the history
  • Loading branch information
sussexrick committed Oct 28, 2023
1 parent 487b9fd commit 9c29991
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void CreateMember_has_form_post_attributes()
[Fact]
public async Task Invalid_ModelState_returns_UmbracoPageResult_and_does_not_attempt_to_create_member()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
using (var controller = CreateController(model, createMemberSucceeds: true))
{
controller.ModelState.AddModelError(string.Empty, "Any error");
Expand All @@ -138,7 +138,7 @@ public async Task Invalid_ModelState_returns_UmbracoPageResult_and_does_not_atte
public async Task Null_model_returns_UmbracoPageResult_and_does_not_attempt_to_create_member()
{
#nullable disable
RegisterModel model = null;
CreateMemberFormData model = null;
using (var controller = CreateController(model, createMemberSucceeds: true))
{
var result = await controller.CreateMember(model);
Expand All @@ -152,7 +152,7 @@ public async Task Null_model_returns_UmbracoPageResult_and_does_not_attempt_to_c
[Fact]
public async Task New_member_returns_RedirectToUmbracoPageResult()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Email = "[email protected]";
MemberService.Setup(x => x.GetByEmail(model.Email)).Returns(Mock.Of<IMember>());

Expand All @@ -170,7 +170,7 @@ public async Task New_member_returns_RedirectToUmbracoPageResult()
[Fact]
public async Task New_member_saves_email_and_token()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };
var token = Guid.NewGuid().ToString();
var tokenExpiry = DateTime.UtcNow.AddDays(1);
var member = new Mock<IMember>();
Expand All @@ -195,7 +195,7 @@ public async Task New_member_saves_email_and_token()
[Fact]
public async Task New_member_is_assigned_to_All_Members()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Email = "[email protected]";
var member = new Mock<IMember>();
member.SetupGet(x => x.Id).Returns(123);
Expand All @@ -216,7 +216,7 @@ public async Task New_member_is_assigned_to_All_Members()
[Fact]
public async Task New_member_is_not_logged_in_automatically()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };
var member = new Mock<IMember>();
member.SetupGet(x => x.Id).Returns(123);
MemberService.Setup(x => x.GetByEmail(model.Email)).Returns(member.Object);
Expand All @@ -236,7 +236,7 @@ public async Task New_member_is_not_logged_in_automatically()
[Fact]
public async Task New_member_sends_Approve_Member_email()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Name = "Member name";
model.Email = "[email protected]";

Expand Down Expand Up @@ -276,7 +276,7 @@ public async Task New_member_sends_Approve_Member_email()
[Fact]
public async Task Creating_a_new_member_is_logged()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Email = "[email protected]";
var member = new Mock<IMember>();
member.SetupGet(x => x.Id).Returns(123);
Expand All @@ -299,7 +299,7 @@ public async Task Creating_a_new_member_is_logged()
[Fact]
public async Task Fail_to_create_member_does_not_save_additional_properties()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Email = "[email protected]";

var member = new Mock<IMember>();
Expand All @@ -317,7 +317,7 @@ public async Task Fail_to_create_member_does_not_save_additional_properties()
[Fact]
public async Task Duplicate_email_sends_Member_Exists_email()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Name = "Member name";
model.Email = "[email protected]";

Expand Down Expand Up @@ -350,7 +350,7 @@ public async Task Duplicate_email_sends_Member_Exists_email()
[Fact]
public async Task Duplicate_email_returns_RedirectToUmbracoPageResult()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };

_emailFormatter.Setup(x => x.FormatEmailContent(MEMBER_EXISTS_EMAIL_SUBJECT, MEMBER_EXISTS_EMAIL_BODY, It.IsAny<Dictionary<string, string>>()))
.Returns((MEMBER_EXISTS_EMAIL_SUBJECT, MEMBER_EXISTS_EMAIL_BODY));
Expand All @@ -366,7 +366,7 @@ public async Task Duplicate_email_returns_RedirectToUmbracoPageResult()
[Fact]
public async Task Duplicate_email_sets_ViewData_FormSuccess_to_true()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };

_emailFormatter.Setup(x => x.FormatEmailContent(MEMBER_EXISTS_EMAIL_SUBJECT, MEMBER_EXISTS_EMAIL_BODY, It.IsAny<Dictionary<string, string>>()))
.Returns((MEMBER_EXISTS_EMAIL_SUBJECT, MEMBER_EXISTS_EMAIL_BODY));
Expand All @@ -382,7 +382,7 @@ public async Task Duplicate_email_sets_ViewData_FormSuccess_to_true()
[Fact]
public async Task Email_matching_requested_email_within_expiry_period_sends_Member_Exists_email()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Name = "Member name";
model.Email = "[email protected]";

Expand Down Expand Up @@ -420,7 +420,7 @@ public async Task Email_matching_requested_email_within_expiry_period_sends_Memb
[Fact]
public async Task Email_matching_requested_email_within_expiry_period_returns_RedirectToUmbracoPageResult()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };

var otherMember = new Mock<IMember>();
var expiryDate = DateTime.Now.AddHours(12);
Expand All @@ -442,7 +442,7 @@ public async Task Email_matching_requested_email_within_expiry_period_returns_Re
[Fact]
public async Task Email_matching_requested_email_within_expiry_period_sets_ViewData_FormSuccess_to_true()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };

var otherMember = new Mock<IMember>();
var expiryDate = DateTime.Now.AddHours(12);
Expand All @@ -464,7 +464,7 @@ public async Task Email_matching_requested_email_within_expiry_period_sets_ViewD
[Fact]
public async Task Email_matching_requested_email_within_expiry_period_does_not_attempt_to_create_member()
{
var model = new RegisterModel { Email = "[email protected]" };
var model = new CreateMemberFormData { Email = "[email protected]" };

var otherMember = new Mock<IMember>();
var expiryDate = DateTime.Now.AddHours(12);
Expand All @@ -487,7 +487,7 @@ public async Task Email_matching_requested_email_within_expiry_period_does_not_a
[Fact]
public async Task Email_matching_requested_email_past_expiry_period_attempts_to_create_member()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();

var otherMember = new Mock<IMember>();
var expiryDate = DateTime.Now.AddHours(-12);
Expand All @@ -508,7 +508,7 @@ public async Task Email_matching_requested_email_past_expiry_period_attempts_to_
[Fact]
public async Task Other_error_is_added_to_ModelState_and_returns_baseResult()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
using (var controller = CreateController(model, createMemberSucceeds: false, emailFieldError: "Some other error."))
{
var result = await controller.CreateMember(model);
Expand All @@ -522,7 +522,7 @@ public async Task Other_error_is_added_to_ModelState_and_returns_baseResult()
[Fact]
public async Task Email_in_TempData_for_view()
{
var model = new RegisterModel();
var model = new CreateMemberFormData();
model.Email = "[email protected]";
using (var controller = CreateController(model))
{
Expand Down

0 comments on commit 9c29991

Please sign in to comment.