コード例 #1
0
            internal Builder(ReqAndHierL2 immutable) : base(immutable)
            {
                this.immutable = immutable;

                this.l2Field1 = immutable.L2Field1;
                this.l2Field2 = immutable.L2Field2;
            }
コード例 #2
0
 public new ReqAndHierL2 ToImmutable()
 {
     return(this.immutable = this.immutable.With(
                ImmutableObjectGraph.Optional.For(this.L1Field1),
                ImmutableObjectGraph.Optional.For(this.L1Field2),
                ImmutableObjectGraph.Optional.For(this.L2Field1),
                ImmutableObjectGraph.Optional.For(this.L2Field2)));
 }
コード例 #3
0
        public void RequiredFieldsAppearInMultipleRelatedTypes()
        {
            ReqAndHierL2 value = ReqAndHierL2.Create("l1f2Value", "l2f2Value");

            Assert.Equal("l1f2Value", value.L1Field2);
            Assert.Equal("l2f2Value", value.L2Field2);
            Assert.Null(value.L1Field1);
            Assert.Null(value.L2Field1);
        }
コード例 #4
0
        public virtual ReqAndHierL2 ToReqAndHierL2(
            System.String l2Field2,
            ImmutableObjectGraph.Optional <System.String> l2Field1 = default(ImmutableObjectGraph.Optional <System.String>))
        {
            ReqAndHierL2 that = this as ReqAndHierL2;

            if (that != null && this.GetType().IsEquivalentTo(typeof(ReqAndHierL2)))
            {
                if ((!l2Field1.IsDefined || l2Field1.Value == that.L2Field1) &&
                    (l2Field2 == that.L2Field2))
                {
                    return(that);
                }
            }

            return(ReqAndHierL2.Create(
                       l1Field1: this.L1Field1,
                       l1Field2: this.L1Field2,
                       l2Field1: l2Field1,
                       l2Field2: l2Field2));
        }