コード例 #1
0
    // 日付情報から期間を所定のフォーマットで返却する
    public string EventDateText()
    {
        string openText  = OpenDate.ToString("yyyy/MM/dd");
        string closeText = CloseDate.ToString("yyyy/MM/dd");

        return(string.Format("{0}-{1}", openText, closeText));
    }
コード例 #2
0
 public Cinema(Name name, OpenDate openSince, City city, List <Room> room) : base(Guid.NewGuid().GetHashCode())
 {
     Name      = name;
     OpenSince = openSince;
     City      = city;
     _room     = room;
 }
コード例 #3
0
        public void Creates_When_OpenDate_Is_Valid_Value(DateTime openDate)
        {
            //Arrange & Act
            var sut = new OpenDate(openDate);

            //Assert
            sut.Value.Should().Be(openDate);
        }
コード例 #4
0
        /// <summary>
        /// Transforms the record into the standard format and returns it as a string.
        /// </summary>
        /// <returns>The record in the standard format as a string.</returns>
        public string getRecord()
        {
            string separator = ",";  // could be \t for tab delimited, etc.
            string record    = AccountCode
                               + separator + Name
                               + separator + Type
                               + separator + ((OpenDate > DateTime.MinValue) ? OpenDate.ToShortDateString() : "")
                               + separator + Currency
            ;

            return(record);
        }
コード例 #5
0
 public void MergeFrom(PositionMessage other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Side != 0)
     {
         Side = other.Side;
     }
     if (other.Price != 0D)
     {
         Price = other.Price;
     }
     if (other.Size != 0D)
     {
         Size = other.Size;
     }
     if (other.Commission != 0D)
     {
         Commission = other.Commission;
     }
     if (other.SwapPointAccumulate != 0D)
     {
         SwapPointAccumulate = other.SwapPointAccumulate;
     }
     if (other.RequireCollateral != 0D)
     {
         RequireCollateral = other.RequireCollateral;
     }
     if (other.openDate_ != null)
     {
         if (openDate_ == null)
         {
             OpenDate = new global::Google.Protobuf.WellKnownTypes.Timestamp();
         }
         OpenDate.MergeFrom(other.OpenDate);
     }
     if (other.Leverage != 0D)
     {
         Leverage = other.Leverage;
     }
     if (other.Pnl != 0D)
     {
         Pnl = other.Pnl;
     }
     if (other.Sfd != 0D)
     {
         Sfd = other.Sfd;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
コード例 #6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Side != 0)
            {
                hash ^= Side.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (Size != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Size);
            }
            if (Commission != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Commission);
            }
            if (SwapPointAccumulate != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(SwapPointAccumulate);
            }
            if (RequireCollateral != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(RequireCollateral);
            }
            if (openDate_ != null)
            {
                hash ^= OpenDate.GetHashCode();
            }
            if (Leverage != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Leverage);
            }
            if (Pnl != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Pnl);
            }
            if (Sfd != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Sfd);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #7
0
        public void Fails_When_OpenDate_Is_Default_DateTime()
        {
            //Arrange
            DateTime openDate = default;

            //Act
            Action action = () =>
            {
                var sut = new OpenDate(openDate);
            };

            //Assert
            action.Should().Throw <ArgumentException>();
        }
コード例 #8
0
        /// <summary>
        ///     Returns true if MarketDefinition instances are equal
        /// </summary>
        /// <param name="other">Instance of MarketDefinition to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MarketDefinition other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Venue == other.Venue || Venue != null && Venue.Equals(other.Venue)) &&
                   (SettledTime == other.SettledTime || SettledTime != null && SettledTime.Equals(other.SettledTime)) &&
                   (Timezone == other.Timezone || Timezone != null && Timezone.Equals(other.Timezone)) &&
                   (EachWayDivisor == other.EachWayDivisor || EachWayDivisor != null && EachWayDivisor.Equals(other.EachWayDivisor)) &&
                   (Regulators == other.Regulators || Regulators != null && Regulators.SequenceEqual(other.Regulators)) &&
                   (MarketType == other.MarketType || MarketType != null && MarketType.Equals(other.MarketType)) &&
                   (MarketBaseRate == other.MarketBaseRate || MarketBaseRate != null && MarketBaseRate.Equals(other.MarketBaseRate)) &&
                   (NumberOfWinners == other.NumberOfWinners || NumberOfWinners != null && NumberOfWinners.Equals(other.NumberOfWinners)) &&
                   (CountryCode == other.CountryCode || CountryCode != null && CountryCode.Equals(other.CountryCode)) &&
                   (InPlay == other.InPlay || InPlay != null && InPlay.Equals(other.InPlay)) &&
                   (BetDelay == other.BetDelay || BetDelay != null && BetDelay.Equals(other.BetDelay)) &&
                   (BspMarket == other.BspMarket || BspMarket != null && BspMarket.Equals(other.BspMarket)) &&
                   (BettingType == other.BettingType || BettingType != null && BettingType.Equals(other.BettingType)) &&
                   (NumberOfActiveRunners == other.NumberOfActiveRunners || NumberOfActiveRunners != null && NumberOfActiveRunners.Equals(other.NumberOfActiveRunners)) &&
                   (EventId == other.EventId || EventId != null && EventId.Equals(other.EventId)) &&
                   (CrossMatching == other.CrossMatching || CrossMatching != null && CrossMatching.Equals(other.CrossMatching)) &&
                   (RunnersVoidable == other.RunnersVoidable || RunnersVoidable != null && RunnersVoidable.Equals(other.RunnersVoidable)) &&
                   (TurnInPlayEnabled == other.TurnInPlayEnabled || TurnInPlayEnabled != null && TurnInPlayEnabled.Equals(other.TurnInPlayEnabled)) &&
                   (SuspendTime == other.SuspendTime || SuspendTime != null && SuspendTime.Equals(other.SuspendTime)) &&
                   (DiscountAllowed == other.DiscountAllowed || DiscountAllowed != null && DiscountAllowed.Equals(other.DiscountAllowed)) &&
                   (PersistenceEnabled == other.PersistenceEnabled || PersistenceEnabled != null && PersistenceEnabled.Equals(other.PersistenceEnabled)) &&
                   (Runners == other.Runners || Runners != null && Runners.SequenceEqual(other.Runners)) &&
                   (Version == other.Version || Version != null && Version.Equals(other.Version)) &&
                   (EventTypeId == other.EventTypeId || EventTypeId != null && EventTypeId.Equals(other.EventTypeId)) &&
                   (Complete == other.Complete || Complete != null && Complete.Equals(other.Complete)) &&
                   (OpenDate == other.OpenDate || OpenDate != null && OpenDate.Equals(other.OpenDate)) &&
                   (MarketTime == other.MarketTime || MarketTime != null && MarketTime.Equals(other.MarketTime)) &&
                   (BspReconciled == other.BspReconciled || BspReconciled != null && BspReconciled.Equals(other.BspReconciled)) &&
                   (Status == other.Status || Status != null && Status.Equals(other.Status)));
        }
コード例 #9
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Venue != null)
                {
                    hash = hash * 59 + Venue.GetHashCode();
                }

                if (SettledTime != null)
                {
                    hash = hash * 59 + SettledTime.GetHashCode();
                }

                if (Timezone != null)
                {
                    hash = hash * 59 + Timezone.GetHashCode();
                }

                if (EachWayDivisor != null)
                {
                    hash = hash * 59 + EachWayDivisor.GetHashCode();
                }

                if (Regulators != null)
                {
                    hash = hash * 59 + Regulators.GetHashCode();
                }

                if (MarketType != null)
                {
                    hash = hash * 59 + MarketType.GetHashCode();
                }

                if (MarketBaseRate != null)
                {
                    hash = hash * 59 + MarketBaseRate.GetHashCode();
                }

                if (NumberOfWinners != null)
                {
                    hash = hash * 59 + NumberOfWinners.GetHashCode();
                }

                if (CountryCode != null)
                {
                    hash = hash * 59 + CountryCode.GetHashCode();
                }

                if (InPlay != null)
                {
                    hash = hash * 59 + InPlay.GetHashCode();
                }

                if (BetDelay != null)
                {
                    hash = hash * 59 + BetDelay.GetHashCode();
                }

                if (BspMarket != null)
                {
                    hash = hash * 59 + BspMarket.GetHashCode();
                }

                if (BettingType != null)
                {
                    hash = hash * 59 + BettingType.GetHashCode();
                }

                if (NumberOfActiveRunners != null)
                {
                    hash = hash * 59 + NumberOfActiveRunners.GetHashCode();
                }

                if (EventId != null)
                {
                    hash = hash * 59 + EventId.GetHashCode();
                }

                if (CrossMatching != null)
                {
                    hash = hash * 59 + CrossMatching.GetHashCode();
                }

                if (RunnersVoidable != null)
                {
                    hash = hash * 59 + RunnersVoidable.GetHashCode();
                }

                if (TurnInPlayEnabled != null)
                {
                    hash = hash * 59 + TurnInPlayEnabled.GetHashCode();
                }

                if (SuspendTime != null)
                {
                    hash = hash * 59 + SuspendTime.GetHashCode();
                }

                if (DiscountAllowed != null)
                {
                    hash = hash * 59 + DiscountAllowed.GetHashCode();
                }

                if (PersistenceEnabled != null)
                {
                    hash = hash * 59 + PersistenceEnabled.GetHashCode();
                }

                if (Runners != null)
                {
                    hash = hash * 59 + Runners.GetHashCode();
                }

                if (Version != null)
                {
                    hash = hash * 59 + Version.GetHashCode();
                }

                if (EventTypeId != null)
                {
                    hash = hash * 59 + EventTypeId.GetHashCode();
                }

                if (Complete != null)
                {
                    hash = hash * 59 + Complete.GetHashCode();
                }

                if (OpenDate != null)
                {
                    hash = hash * 59 + OpenDate.GetHashCode();
                }

                if (MarketTime != null)
                {
                    hash = hash * 59 + MarketTime.GetHashCode();
                }

                if (BspReconciled != null)
                {
                    hash = hash * 59 + BspReconciled.GetHashCode();
                }

                if (Status != null)
                {
                    hash = hash * 59 + Status.GetHashCode();
                }

                return(hash);
            }
        }
コード例 #10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (ExchangeId.Length != 0)
            {
                hash ^= ExchangeId.GetHashCode();
            }
            if (InstrumentName.Length != 0)
            {
                hash ^= InstrumentName.GetHashCode();
            }
            if (ProductId.Length != 0)
            {
                hash ^= ProductId.GetHashCode();
            }
            if (ProductClass != 0)
            {
                hash ^= ProductClass.GetHashCode();
            }
            if (DeliveryYear != 0)
            {
                hash ^= DeliveryYear.GetHashCode();
            }
            if (DeliveryMonth != 0)
            {
                hash ^= DeliveryMonth.GetHashCode();
            }
            if (MaxMarketOrderVolume != 0)
            {
                hash ^= MaxMarketOrderVolume.GetHashCode();
            }
            if (MinMarketOrderVolume != 0)
            {
                hash ^= MinMarketOrderVolume.GetHashCode();
            }
            if (MaxLimitOrderVolume != 0)
            {
                hash ^= MaxLimitOrderVolume.GetHashCode();
            }
            if (MinLimitOrderVolume != 0)
            {
                hash ^= MinLimitOrderVolume.GetHashCode();
            }
            if (VolumeMultiple != 0)
            {
                hash ^= VolumeMultiple.GetHashCode();
            }
            if (PriceTick != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(PriceTick);
            }
            if (CreateDate.Length != 0)
            {
                hash ^= CreateDate.GetHashCode();
            }
            if (OpenDate.Length != 0)
            {
                hash ^= OpenDate.GetHashCode();
            }
            if (ExpireDate.Length != 0)
            {
                hash ^= ExpireDate.GetHashCode();
            }
            if (StartDelivDate.Length != 0)
            {
                hash ^= StartDelivDate.GetHashCode();
            }
            if (EndDelivDate.Length != 0)
            {
                hash ^= EndDelivDate.GetHashCode();
            }
            if (IsTrading != false)
            {
                hash ^= IsTrading.GetHashCode();
            }
            if (UnderlyingMultiple != 0)
            {
                hash ^= UnderlyingMultiple.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #11
0
 // Formats campground details to look nice and neat
 public override string ToString()
 {
     return(CampgroundId.ToString().PadRight(15) + CampgroundName.ToString().PadRight(50) + OpenDate.ToString().PadRight(15) + CloseDate.ToString().PadRight(20) + "$" + DailyFee.ToString());
 }