Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-10350 - Decommission obsolete feature flags #159

Merged
merged 10 commits into from
Sep 12, 2024
39 changes: 0 additions & 39 deletions NotificationApi/NotificationApi.Common/Util/FeatureToggles.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
using NotificationApi.Common.Util;
using Testing.Common.Stubs;

namespace NotificationApi.IntegrationTests.Api.ParticipantNotifications
{
public class SendParticipantMultiDayHearingConfirmationForExistingUserEmailTests : ApiTest
{
private AsyncNotificationClientStub _notifyStub;
private FeatureTogglesStub _featureToggleStub;

[SetUp]
public void Setup()
{
var scope = Application.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
_notifyStub = scope.ServiceProvider.GetRequiredService<IAsyncNotificationClient>() as AsyncNotificationClientStub;
_notifyStub!.SentEmails.Clear();
_featureToggleStub = Application.Services.GetService(typeof(IFeatureToggles)) as FeatureTogglesStub;
_featureToggleStub!.UseNew2023Templates = false;
}


Expand Down Expand Up @@ -166,48 +161,9 @@ public async Task should_send_a_multi_day_confirmation_email_for_a_judiciary_jud
}

[Test]
public async Task should_send_a_multi_day_confirmation_email_for_a_representative_feature_toggle_off()
public async Task should_send_a_multi_day_confirmation_email_for_a_representative()
{
// arrange
_featureToggleStub!.UseNew2023Templates = false;
var request = new ExistingUserMultiDayHearingConfirmationRequest
{
RoleName = RoleNames.Representative,
Name = $"{Faker.Name.FullName()}",
CaseNumber = $"{Faker.RandomNumber.Next()}",
CaseName = $"{Faker.RandomNumber.Next()}",
HearingId = Guid.NewGuid(),
ParticipantId = Guid.NewGuid(),
ContactEmail = $"{Guid.NewGuid()}@intautomation.com",
Username = $"{Guid.NewGuid()}@intautomation.com",
ScheduledDateTime = DateTime.UtcNow.AddDays(1),
Representee = $"{Faker.Name.FullName()}",
TotalDays = 3
};

// act
using var client = Application.CreateClient();
var result = await client.PostAsync(
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantMultiDayHearingConfirmationForExistingUserEmail, RequestBody.Set(request));

// assert
result.IsSuccessStatusCode.Should().BeTrue(result.Content.ReadAsStringAsync().Result);

var notifications = await TestDataManager.GetNotifications(request.HearingId.Value,
request.ParticipantId.Value, Domain.Enums.NotificationType.HearingConfirmationRepresentativeMultiDay,
request.ContactEmail);
notifications.Count.Should().Be(1);
_notifyStub.SentEmails.Count.Should().Be(1);
_notifyStub.SentEmails.Exists(x => x.EmailAddress == request.ContactEmail
&& x.ExternalRefId == notifications[0].ExternalId
).Should().BeTrue();
}

[Test]
public async Task should_send_a_multi_day_confirmation_email_for_a_representative_feature_toggle_on()
{
// arrange
_featureToggleStub!.UseNew2023Templates = true;
var request = new ExistingUserMultiDayHearingConfirmationRequest
{
RoleName = RoleNames.Representative,
Expand Down Expand Up @@ -242,46 +198,8 @@ public async Task should_send_a_multi_day_confirmation_email_for_a_representativ
}

[Test]
public async Task should_send_a_multi_day_confirmation_email_for_a_lip_feature_toggle_off()
{
// arrange
_featureToggleStub!.UseNew2023Templates = false;
var request = new ExistingUserMultiDayHearingConfirmationRequest
{
RoleName = RoleNames.Individual,
Name = $"{Faker.Name.FullName()}",
CaseNumber = $"{Faker.RandomNumber.Next()}",
CaseName = $"{Faker.RandomNumber.Next()}",
HearingId = Guid.NewGuid(),
ParticipantId = Guid.NewGuid(),
ContactEmail = $"{Guid.NewGuid()}@intautomation.com",
Username = $"{Guid.NewGuid()}@intautomation.com",
ScheduledDateTime = DateTime.UtcNow.AddDays(1),
TotalDays = 3
};

// act
using var client = Application.CreateClient();
var result = await client.PostAsync(
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantMultiDayHearingConfirmationForExistingUserEmail, RequestBody.Set(request));

// assert
result.IsSuccessStatusCode.Should().BeTrue(result.Content.ReadAsStringAsync().Result);

var notifications = await TestDataManager.GetNotifications(request.HearingId.Value, request.ParticipantId.Value,
Domain.Enums.NotificationType.HearingConfirmationLipMultiDay,
request.ContactEmail);
notifications.Count.Should().Be(1);
_notifyStub.SentEmails.Count.Should().Be(1);
_notifyStub.SentEmails.Exists(x => x.EmailAddress == request.ContactEmail
&& x.ExternalRefId == notifications[0].ExternalId
).Should().BeTrue();
}

[Test]
public async Task should_send_a_multi_day_confirmation_email_for_a_lip_feature_toggle_on()
public async Task should_send_a_multi_day_confirmation_email_for_a_lip()
{
_featureToggleStub!.UseNew2023Templates = true;
// arrange
var request = new ExistingUserMultiDayHearingConfirmationRequest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
using NotificationApi.Common.Util;
using Testing.Common.Stubs;

namespace NotificationApi.IntegrationTests.Api.ParticipantNotifications
{
public class SendParticipantSingleDayHearingConfirmationForExistingUserEmailTests : ApiTest
{
private AsyncNotificationClientStub _notifyStub;
private FeatureTogglesStub _featureToggleStub;

[SetUp]
public void Setup()
{
var scope = Application.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
_notifyStub = scope.ServiceProvider.GetRequiredService<IAsyncNotificationClient>() as AsyncNotificationClientStub;
_notifyStub!.SentEmails.Clear();
_featureToggleStub = Application.Services.GetService(typeof(IFeatureToggles)) as FeatureTogglesStub;
_featureToggleStub!.UseNew2023Templates = false;
}

[Test]
Expand Down Expand Up @@ -221,47 +216,9 @@ public async Task should_send_a_confirmation_email_for_a_judiciary_judge()
}

[Test]
public async Task should_send_a_confirmation_email_for_a_representative_toggle_off()
public async Task should_send_a_confirmation_email_for_a_representative()
{
// arrange
_featureToggleStub!.UseNew2023Templates = false;
var request = new ExistingUserSingleDayHearingConfirmationRequest
{
RoleName = RoleNames.Representative,
Name = $"{Faker.Name.FullName()}",
CaseNumber = $"{Faker.RandomNumber.Next()}",
CaseName = $"{Faker.RandomNumber.Next()}",
HearingId = Guid.NewGuid(),
ParticipantId = Guid.NewGuid(),
ContactEmail = $"{Guid.NewGuid()}@intautomation.com",
Username = $"{Guid.NewGuid()}@intautomation.com",
ScheduledDateTime = DateTime.UtcNow.AddDays(1),
Representee = $"{Faker.Name.FullName()}"
};

// act
using var client = Application.CreateClient();
var result = await client.PostAsync(
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantSingleDayHearingConfirmationForExistingUserEmail, RequestBody.Set(request));

// assert
result.IsSuccessStatusCode.Should().BeTrue(result.Content.ReadAsStringAsync().Result);

var notifications = await TestDataManager.GetNotifications(request.HearingId.Value,
request.ParticipantId.Value, Domain.Enums.NotificationType.HearingConfirmationRepresentative,
request.ContactEmail);
notifications.Count.Should().Be(1);
_notifyStub.SentEmails.Count.Should().Be(1);
_notifyStub.SentEmails.Exists(x => x.EmailAddress == request.ContactEmail
&& x.ExternalRefId == notifications[0].ExternalId
).Should().BeTrue();
}

[Test]
public async Task should_send_a_confirmation_email_for_a_representative_toggle_on()
{
// arrange
_featureToggleStub!.UseNew2023Templates = true;
var request = new ExistingUserSingleDayHearingConfirmationRequest
{
RoleName = RoleNames.Representative,
Expand Down Expand Up @@ -295,46 +252,9 @@ public async Task should_send_a_confirmation_email_for_a_representative_toggle_o
}

[Test]
public async Task should_send_a_confirmation_email_for_a_lip_feature_toggle_off()
{
// arrange
_featureToggleStub!.UseNew2023Templates = false;
var request = new ExistingUserSingleDayHearingConfirmationRequest
{
RoleName = RoleNames.Individual,
Name = $"{Faker.Name.FullName()}",
CaseNumber = $"{Faker.RandomNumber.Next()}",
CaseName = $"{Faker.RandomNumber.Next()}",
HearingId = Guid.NewGuid(),
ParticipantId = Guid.NewGuid(),
ContactEmail = $"{Guid.NewGuid()}@intautomation.com",
Username = $"{Guid.NewGuid()}@intautomation.com",
ScheduledDateTime = DateTime.UtcNow.AddDays(1)
};

// act
using var client = Application.CreateClient();
var result = await client.PostAsync(
ApiUriFactory.ParticipantNotificationEndpoints.SendParticipantSingleDayHearingConfirmationForExistingUserEmail, RequestBody.Set(request));

// assert
result.IsSuccessStatusCode.Should().BeTrue(result.Content.ReadAsStringAsync().Result);

var notifications = await TestDataManager.GetNotifications(request.HearingId.Value, request.ParticipantId.Value,
Domain.Enums.NotificationType.HearingConfirmationLip,
request.ContactEmail);
notifications.Count.Should().Be(1);
_notifyStub.SentEmails.Count.Should().Be(1);
_notifyStub.SentEmails.Exists(x => x.EmailAddress == request.ContactEmail
&& x.ExternalRefId == notifications[0].ExternalId
).Should().BeTrue();
}

[Test]
public async Task should_send_a_confirmation_email_for_a_lip_feature_toggle_on()
public async Task should_send_a_confirmation_email_for_a_lip()
{
// arrange
_featureToggleStub!.UseNew2023Templates = true;
var request = new ExistingUserSingleDayHearingConfirmationRequest
{
RoleName = RoleNames.Individual,
Expand Down
Loading
Loading