コード例 #1
0
        public void Sync_ShouldWorkWhenEnabled()
        {
            using (One<Unicycle>.ToOne<Wheel>.Setup().Connect(m => m.Wheel, w => w.Unicycle))
            {
                {
                    var wheel1 = new Wheel();
                    wheel1.Unicycle.Should().BeNull();
                    var unicycle1 = new Unicycle(wheel1);
                    wheel1.Unicycle.Should().NotBeNull();
                    var wheel2 = new Wheel();
                    wheel2.Unicycle.Should().BeNull();
                    wheel2.Unicycle = unicycle1;
                    wheel2.Unicycle.Should().NotBeNull();
                    wheel1.Unicycle.Should().BeNull();
                }

                {
                    var unicycle1 = new Unicycle();
                    unicycle1.Wheel.Should().BeNull();
                    var wheel1 = new Wheel(unicycle1);
                    unicycle1.Wheel.Should().NotBeNull();
                    var unicycle2 = new Unicycle();
                    unicycle2.Wheel.Should().BeNull();
                    unicycle2.Wheel = wheel1;
                    unicycle2.Wheel.Should().NotBeNull();
                    unicycle1.Wheel.Should().BeNull();
                }
            }
        }
コード例 #2
0
 public Wheel(Unicycle unicycle)
 {
     Unicycle = unicycle;
     this.Constructed();
 }