Ejemplo n.º 1
0
        public void Do_NoneReceivesAction_ActionNotInvoked()
        {
            bool            callbackInvoked = false;
            Action <object> callback        = obj => callbackInvoked = true;

            IOption <object> option = Option.None <object>();

            option.Do(callback);

            Assert.False(callbackInvoked);
        }
Ejemplo n.º 2
0
        public void Do_SomeReceivesAction_ActionIsInvoked()
        {
            bool       callbackInvoked = false;
            Action <T> callback        = obj => callbackInvoked = true;

            IOption <T> option = this.CreateSome(this.SampleValue);

            option.Do(callback);

            Assert.True(callbackInvoked);
        }
Ejemplo n.º 3
0
        public void Do_SomeContainingObjectReceivesAction_ActionReceivesThatContainedObject()
        {
            T          expectedArgument = this.SampleValue;
            T          actualArgument   = default(T);
            Action <T> callback         = obj => actualArgument = obj;

            IOption <T> option = this.CreateSome(expectedArgument);

            option.Do(callback);

            Assert.True(this.AreSame(expectedArgument, actualArgument));
        }