コード例 #1
0
        public void HandleParcel(Parcel parcel)
        {
            IParcelHandler handler = new InsuranceHandler();

            handler.SetNext(new PackagingHandler());
            handler.Handle(parcel);
        }
コード例 #2
0
        public void Handle_ShouldAskForApproval_IfNotAskedBeforeAndValueOver1000()
        {
            //  Arrange
            Parcel parcel = new Parcel();

            parcel.Value = 1000;

            //  Act
            var attempt = _sut.Handle(parcel);

            //  Assert
            attempt.Success.Should().BeFalse();
            attempt.Result.RequiresApproval.Should().BeTrue();
            attempt.Result.Parcel.Should().BeSameAs(parcel);
            attempt.Exception.Should().BeNull();
        }