mirror of
https://github.com/bitwarden/server.git
synced 2026-06-01 12:26:46 -05:00
* Implementation desktop and browser checkout * Fixed the failing test * Add a logger to see gobal settings in qa * Add log * fix the lint error * Removed the log
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Bit.Api.Billing.Models.Requests.Premium;
|
|
using Xunit;
|
|
|
|
namespace Bit.Api.Test.Billing.Models.Requests;
|
|
|
|
public class CreatePremiumCheckoutSessionRequestTests
|
|
{
|
|
[Theory]
|
|
[InlineData("ios")]
|
|
[InlineData("android")]
|
|
[InlineData("browser")]
|
|
[InlineData("desktop")]
|
|
public void Validate_SupportedPlatform_ReturnsNoErrors(string platform)
|
|
{
|
|
// Arrange
|
|
var sut = new CreatePremiumCheckoutSessionRequest { Platform = platform };
|
|
|
|
// Act
|
|
var results = sut.Validate(new ValidationContext(sut)).ToList();
|
|
|
|
// Assert
|
|
Assert.Empty(results);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("web")]
|
|
[InlineData("unknown")]
|
|
[InlineData("")]
|
|
public void Validate_UnsupportedPlatform_ReturnsValidationError(string platform)
|
|
{
|
|
// Arrange
|
|
var sut = new CreatePremiumCheckoutSessionRequest { Platform = platform };
|
|
|
|
// Act
|
|
var results = sut.Validate(new ValidationContext(sut)).ToList();
|
|
|
|
// Assert
|
|
Assert.Single(results);
|
|
Assert.Contains(nameof(CreatePremiumCheckoutSessionRequest.Platform), results[0].MemberNames);
|
|
}
|
|
}
|