Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using FluentAssertions;
|
|
using Fengling.Member.Domain.Aggregates.PointsRuleModel;
|
|
using Fengling.Member.Domain.Aggregates.PointsRuleModel.Enums;
|
|
|
|
namespace Fengling.Member.Domain.Tests.Aggregates.PointsRuleModel;
|
|
|
|
public class PointsRuleConditionTests
|
|
{
|
|
[Fact]
|
|
public void Create_ShouldInitializeWithCorrectValues()
|
|
{
|
|
var rule = PointsRule.Create(
|
|
"消费送积分",
|
|
"CONSUMPTION_POINTS",
|
|
RuleType.PriceWeighted,
|
|
50,
|
|
30);
|
|
|
|
var condition = PointsRuleCondition.Create(
|
|
rule.Id,
|
|
DimensionType.Product,
|
|
"100",
|
|
">=");
|
|
|
|
condition.RuleId.Should().Be(rule.Id);
|
|
condition.DimensionType.Should().Be(DimensionType.Product);
|
|
condition.DimensionValue.Should().Be("100");
|
|
condition.Operator.Should().Be(">=");
|
|
}
|
|
|
|
[Fact]
|
|
public void Create_WithNullOperator_ShouldAllowNullOperator()
|
|
{
|
|
var rule = PointsRule.Create(
|
|
"注册送积分",
|
|
"REGISTER_POINTS",
|
|
RuleType.FixedValue,
|
|
100,
|
|
30);
|
|
|
|
var condition = PointsRuleCondition.Create(
|
|
rule.Id,
|
|
DimensionType.Dealer,
|
|
"1");
|
|
|
|
condition.Operator.Should().BeNull();
|
|
}
|
|
}
|