- gRPC auth service for token validation - Value comparator system (string, numeric, boolean, datetime, collection) - Condition evaluator with strategy chain - Form definition and data improvements - Workflow instance/task endpoints updated - Seed data and EF design-time factory - Test coverage for comparators and handlers
71 lines
1.6 KiB
C#
71 lines
1.6 KiB
C#
namespace Workflow.Tests.Condition;
|
|
|
|
using FluentAssertions;
|
|
using Workflow.Domain.Expressions.Comparators;
|
|
using Xunit;
|
|
|
|
public class BooleanComparatorTests
|
|
{
|
|
private readonly BooleanComparator _sut = new();
|
|
|
|
[Fact]
|
|
public void Compare_Equals_TrueTrue_ReturnsTrue()
|
|
{
|
|
_sut.Compare(true, "==", true).Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_Equals_TrueFalse_ReturnsFalse()
|
|
{
|
|
_sut.Compare(true, "==", false).Should().BeFalse();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_Equals_StringBoolean_ReturnsTrue()
|
|
{
|
|
_sut.Compare("true", "==", "true").Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_Equals_StringBooleanCaseInsensitive()
|
|
{
|
|
_sut.Compare("True", "==", "true").Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_NotEquals_TrueFalse_ReturnsTrue()
|
|
{
|
|
_sut.Compare(true, "!=", false).Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_BoolAndStringBool_ReturnsTrue()
|
|
{
|
|
_sut.Compare(true, "==", "true").Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_NonBooleanField_ReturnsFalse()
|
|
{
|
|
_sut.Compare("hello", "==", "true").Should().BeFalse();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_NullField_ReturnsFalse()
|
|
{
|
|
_sut.Compare(null, "==", "true").Should().BeFalse();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_UnsupportedOperator_ReturnsFalse()
|
|
{
|
|
_sut.Compare(true, ">", false).Should().BeFalse();
|
|
}
|
|
|
|
[Fact]
|
|
public void Compare_FalseEqualsFalse_ReturnsTrue()
|
|
{
|
|
_sut.Compare(false, "==", false).Should().BeTrue();
|
|
}
|
|
}
|