diff --git a/Mohaymen.GiteaClient.Tests/Gitea/Branch/CreateBranch/Validators/CreateBranchCommandValidatorTests.cs b/Mohaymen.GiteaClient.Tests/Gitea/Branch/CreateBranch/Validators/CreateBranchCommandValidatorTests.cs index 4fdac09..f06fe5f 100644 --- a/Mohaymen.GiteaClient.Tests/Gitea/Branch/CreateBranch/Validators/CreateBranchCommandValidatorTests.cs +++ b/Mohaymen.GiteaClient.Tests/Gitea/Branch/CreateBranch/Validators/CreateBranchCommandValidatorTests.cs @@ -23,7 +23,9 @@ public void Validate_ShouldReturnEmptyRepositoryNameErrorCode_WhenRepositoryName // Arrange var command = new CreateBranchCommand { - RepositoryName = repositoryName + RepositoryName = repositoryName, + NewBranchName = "new_branch", + OldReferenceName = "old_ref" }; // Act @@ -42,7 +44,9 @@ public void Validate_ShouldReturnEmptyNewBranchNameErrorCode_WhenNewBranchNameIs // Arrange var command = new CreateBranchCommand { - NewBranchName = newBranchName + RepositoryName = "repo", + NewBranchName = newBranchName, + OldReferenceName = "old_ref" }; // Act @@ -61,6 +65,8 @@ public void Validate_ShouldReturnEmptyOldReferenceNameErrorCode_WhenOldReference // Arrange var command = new CreateBranchCommand { + RepositoryName = "repo", + NewBranchName = "new_branch", OldReferenceName = oldReferenceName }; diff --git a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Commands/CreateBranchCommand.cs b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Commands/CreateBranchCommand.cs index 57a3525..e40fd28 100644 --- a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Commands/CreateBranchCommand.cs +++ b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Commands/CreateBranchCommand.cs @@ -14,9 +14,9 @@ namespace Mohaymen.GiteaClient.Gitea.Branch.CreateBranch.Commands; internal class CreateBranchCommand : IRequest> { - public string RepositoryName { get; init; } - public string NewBranchName { get; init; } - public string OldReferenceName { get; init; } + public required string RepositoryName { get; init; } + public required string NewBranchName { get; init; } + public required string OldReferenceName { get; init; } } internal class CreateBranchCommandHandler : IRequestHandler> diff --git a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Context/CreateBranchRequest.cs b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Context/CreateBranchRequest.cs index a73b1b3..e2848dc 100644 --- a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Context/CreateBranchRequest.cs +++ b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Context/CreateBranchRequest.cs @@ -5,8 +5,8 @@ namespace Mohaymen.GiteaClient.Gitea.Branch.CreateBranch.Context; public class CreateBranchRequest { [JsonProperty("new_branch_name")] - public string NewBranchName { get; init; } + public required string NewBranchName { get; init; } [JsonProperty("old_ref_name")] - public string OldReferenceName { get; init; } + public required string OldReferenceName { get; init; } } \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchCommandDto.cs b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchCommandDto.cs index 6178983..328bd5f 100644 --- a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchCommandDto.cs +++ b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchCommandDto.cs @@ -2,7 +2,7 @@ public class CreateBranchCommandDto { - public string RepositoryName { get; init; } - public string NewBranchName { get; init; } - public string OldReferenceName { get; init; } + public required string RepositoryName { get; init; } + public required string NewBranchName { get; init; } + public required string OldReferenceName { get; init; } } \ No newline at end of file diff --git a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchResponseDto.cs b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchResponseDto.cs index 2948c1a..a01a1e6 100644 --- a/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchResponseDto.cs +++ b/Mohaymen.GiteaClient/Gitea/Branch/CreateBranch/Dtos/CreateBranchResponseDto.cs @@ -5,5 +5,5 @@ namespace Mohaymen.GiteaClient.Gitea.Branch.CreateBranch.Dtos; public class CreateBranchResponseDto { [JsonProperty("name")] - public string BranchName { get; init; } + public required string BranchName { get; init; } } \ No newline at end of file