Skip to content

Commit

Permalink
Added tests for shared
Browse files Browse the repository at this point in the history
  • Loading branch information
pingu2k4 committed Jul 9, 2024
1 parent 9f6cebe commit c377843
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class UpdatePhoneRequest
/// Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212
/// </summary>
[JsonPropertyName("phone")]
public string? Phone { get; set; }
public string Phone { get; set; } = string.Empty;

/// <summary>
/// New user password. Must be at least 8 chars
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using PinguApps.Appwrite.Shared.Requests;

namespace PinguApps.Appwrite.Shared.Tests.Requests;

public class UpdatePhoneRequestTests
{
[Fact]
public void Constructor_InitializesWithExpectedValues()
{
// Arrange & Act
var request = new UpdatePhoneRequest();

// Assert
Assert.NotNull(request.Password);
Assert.NotNull(request.Phone);
Assert.Equal(string.Empty, request.Password);
Assert.Equal(string.Empty, request.Phone);
}

[Theory]
[InlineData("password", "+123456789")]
[InlineData("drowssap", "+987654321")]
public void Properties_CanBeSet(string password, string phone)
{
// Arrange
var request = new UpdatePhoneRequest();

// Act
request.Password = password;
request.Phone = phone;

// Assert
Assert.Equal(password, request.Password);
Assert.Equal(phone, request.Phone);
}
}

0 comments on commit c377843

Please sign in to comment.