public void Value_get_should_return_the_correct_value_if_state_is_fulfilled() { ISailor s = A.Sailor(); IPromise promise = s.Promise; s.Resolve(3); //a fulfilled promise value should return the parameter passed to the Sailor.Fulfill method Assert.Equal(3, (int)s.Promise.Value); }
public void Reason_get_should_return_throw_if_state_is_fulfilled() { ISailor s = A.Sailor(); IPromise promise = s.Promise; s.Resolve(50); //a fulfilled promise value should remain null var ex = Assert.Throws(typeof(InvalidOperationException), new Assert.ThrowsDelegateWithReturn(() => { return(s.Promise.Reason); })); Assert.NotNull(ex); }