Ejemplo n.º 1
0
        public void EmptyWithRegeneratesType()
        {
            var empty = EmptyDerivedFromAbstract.Create();
            AbstractNonEmpty emptyAsBase = empty;

            EmptyDerivedFromAbstract newInstance       = empty.With(oneField: true);
            AbstractNonEmpty         newInstanceAsBase = emptyAsBase.With(oneField: true);

            Assert.Equal(empty.Identity, newInstance.Identity);
            Assert.Equal(empty.Identity, newInstanceAsBase.Identity);
        }
        public virtual EmptyDerivedFromAbstract ToEmptyDerivedFromAbstract()
        {
            EmptyDerivedFromAbstract that = this as EmptyDerivedFromAbstract;

            if (that != null && this.GetType().IsEquivalentTo(typeof(EmptyDerivedFromAbstract)))
            {
                return(that);
            }

            return(EmptyDerivedFromAbstract.CreateWithIdentity(
                       oneField: Optional.For(this.OneField),
                       identity: this.Identity));
        }
 public new EmptyDerivedFromAbstract ToImmutable()
 {
     return this.immutable = this.immutable;
 }
 internal Builder(EmptyDerivedFromAbstract immutable)
     : base(immutable)
 {
     this.immutable = immutable;
 }
 public new EmptyDerivedFromAbstract ToImmutable()
 {
     return(this.immutable = this.immutable);
 }
 internal Builder(EmptyDerivedFromAbstract immutable) : base(immutable)
 {
     this.immutable = immutable;
 }