コード例 #1
0
        public void monad_with_null()
        {
            IPhone phone = A.Fake <IPhone>();

            BuildingFactory.AtWorkNullPhoneNumber()
            .With(b => b.Manager)
            .With(m => m.ContactInfo)
            .With(c => c.PhoneNumber)
            .Do(phoneNumber => phone.Call(phoneNumber));

            A.CallTo(() => phone.Call(null)).WithAnyArguments().MustNotHaveHappened();
        }
コード例 #2
0
        public void monad_with_null()
        {
            IPhone phone = A.Fake <IPhone>();

            BuildingFactory.AtWorkNullPhoneNumber()
            .With(b => b.Manager)
            .Log("Found Manager")
            .If(m => m.IsAtWork)
            .Log("Manager is at work")
            .With(m => m.ContactInfo)
            .With(c => c.PhoneNumber)
            .Log("Dialing The Manager")
            .Do((p) => phone.Call(p));

            A.CallTo(() => phone.Call(null)).WithAnyArguments().MustNotHaveHappened();
        }