Пример #1
0
        public void Aggregate_reconstruct_a_valid()
        {
            var be  = BusinessEntity.From(EntityTestId.GetNext(), Version.New());
            var agg = TestAggregateRoot.ReconstructFrom(be);

            Assert.True(agg.ValidationResults.IsValid);
        }
Пример #2
0
        public static EntityTestId From(Guid id)
        {
            var entityId  = new EntityTestId(id);
            var validator = new EntityIdTestValidator();

            entityId.SetValidationResult(validator.Validate(entityId));

            return(entityId);
        }
        public void EntityId_create_an_invalid()
        {
            var fixture = new Fixture();

            fixture.Register <EntityTestId>(() => EntityTestId.From(Guid.Empty));

            var entityId = fixture.Create <EntityTestId>();

            Assert.False(entityId.ValidationResults.IsValid);
        }
        public void EntityId_create_a_valid()
        {
            var fixture = new Fixture();

            fixture.Register <EntityTestId>(() => EntityTestId.From(fixture.Create <Guid>()));

            var entityId = fixture.Create <EntityTestId>();

            Assert.True(entityId.ValidationResults.IsValid);
        }
Пример #5
0
        public int CompareTo(EntityTestId other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            return(Value.CompareTo(other.Value));
        }
Пример #6
0
 public static EntityTestId Empty()
 {
     return(EntityTestId.From(Guid.Empty));
 }