Exemplo n.º 1
0
        public IZoneDifferenceStrategy GetZoneDifferenceDecoratorInstance(DeliveryMethodEnum input)
        {
            IZoneDifferenceStrategy result = null;

            switch (input)
            {
            case DeliveryMethodEnum.Air:
            case DeliveryMethodEnum.Ground:
                if (timeZoneDifferenceDecorator == null)
                {
                    timeZoneDifferenceDecorator = new TimeZoneDifferenceStrategy();
                }
                result = timeZoneDifferenceDecorator;
                break;

            case DeliveryMethodEnum.Rail:
                if (orientationZoneDifferenceDecorator == null)
                {
                    orientationZoneDifferenceDecorator = new OrientationZoneDifferenceStrategy();
                }
                result = orientationZoneDifferenceDecorator;
                break;

            default:
                break;
            }

            return(result);
        }
Exemplo n.º 2
0
        public void GetZoneDifferenceDecoratorInstanceTest()
        {
            ZoneDifferenceStrategyFactory target   = ZoneDifferenceStrategyFactory.GetInstance();
            DeliveryMethodEnum            input    = DeliveryMethodEnum.Rail;
            IZoneDifferenceStrategy       expected = ZoneDifferenceStrategyFactory.GetInstance().GetZoneDifferenceDecoratorInstance(DeliveryMethodEnum.Rail);
            IZoneDifferenceStrategy       actual;

            actual = target.GetZoneDifferenceDecoratorInstance(input);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InterestRateSwaption" /> class.
        /// </summary>
        /// <param name="startDate">The start date of the instrument. This is normally synonymous with the trade-date. (required).</param>
        /// <param name="payOrReceiveFixed">The available values are: NotDefined, Pay, Receive (required).</param>
        /// <param name="deliveryMethod">The available values are: Cash, Physical (required).</param>
        /// <param name="swap">swap (required).</param>
        public InterestRateSwaption(DateTimeOffset?startDate = default(DateTimeOffset?), PayOrReceiveFixedEnum payOrReceiveFixed = default(PayOrReceiveFixedEnum), DeliveryMethodEnum deliveryMethod = default(DeliveryMethodEnum), InterestRateSwap swap = default(InterestRateSwap), InstrumentTypeEnum instrumentType = default(InstrumentTypeEnum)) : base(instrumentType)
        {
            // to ensure "startDate" is required (not null)
            if (startDate == null)
            {
                throw new InvalidDataException("startDate is a required property for InterestRateSwaption and cannot be null");
            }
            else
            {
                this.StartDate = startDate;
            }

            // to ensure "payOrReceiveFixed" is required (not null)
            if (payOrReceiveFixed == null)
            {
                throw new InvalidDataException("payOrReceiveFixed is a required property for InterestRateSwaption and cannot be null");
            }
            else
            {
                this.PayOrReceiveFixed = payOrReceiveFixed;
            }

            // to ensure "deliveryMethod" is required (not null)
            if (deliveryMethod == null)
            {
                throw new InvalidDataException("deliveryMethod is a required property for InterestRateSwaption and cannot be null");
            }
            else
            {
                this.DeliveryMethod = deliveryMethod;
            }

            // to ensure "swap" is required (not null)
            if (swap == null)
            {
                throw new InvalidDataException("swap is a required property for InterestRateSwaption and cannot be null");
            }
            else
            {
                this.Swap = swap;
            }
        }