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

Adds optional param to TeachingEventAddAttendee #1330

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class TeachingEventAddAttendee

[SwaggerSchema(WriteOnly = true)]
public Guid? EventId { get; set; }

[SwaggerSchema(WriteOnly = true)]
public int? ChannelId { get; set; }

[SwaggerSchema(WriteOnly = true)]
public Guid? AcceptedPolicyId { get; set; }
public Guid? PreferredTeachingSubjectId { get; set; }
Expand Down Expand Up @@ -136,7 +140,7 @@ private void ConfigureChannel(Candidate candidate)
{
if (CandidateId == null)
{
candidate.ChannelId = (int?)Candidate.Channel.Event;
candidate.ChannelId = ChannelId ?? (int?)Candidate.Channel.Event;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ public void Candidate_ChannelIdWhenCandidateIdIsNull_IsMailingList()
request.Candidate.ChannelId.Should().Be((int)Candidate.Channel.Event);
}

[Fact]
public void Candidate_WithNonNullChannelIdWhenCandidateIdIsNull_IsMailingList()
{
var request = new TeachingEventAddAttendee() { CandidateId = null, ChannelId = 456 };

request.Candidate.ChannelId.Should().Be(456);
}

[Fact]
public void Candidate_ChannelIdWhenCandidateIdIsNotNull_IsNotChanged()
{
Expand Down
Loading