Exemplo n.º 1
0
        public static Pot CreatePot(int id, int tripId, string organizer = "orga", PotMode mode = PotMode.Lead,
                                    double amount             = 1000, double targetAmount       = 2000, string name                = "PotName",
                                    DateTime?startDate        = null, DateTime?endDate          = null, DateTime?validityDate      = null,
                                    string description        = "TestDesc", bool isCancelled    = false, string cancellationReason = "Reason",
                                    DateTime?cancellationDate = null, DateTime?modificationDate = null)
        {
            var valStart     = startDate.HasValue ? startDate.Value : DateTime.Today;
            var valEnd       = endDate.HasValue ? endDate.Value : DateTime.Today;
            var valValidity  = validityDate.HasValue ? validityDate.Value : DateTime.Today;
            var valModifDate = modificationDate.HasValue ? modificationDate.Value : DateTime.Today;
            var pot          = new Pot
                               (
                id,
                tripId,
                organizer,
                mode,
                amount,
                targetAmount,
                name,
                valStart,
                valEnd,
                valValidity,
                description,
                isCancelled,
                cancellationReason,
                cancellationDate
                               );

            pot.ModificationDate = valModifDate;
            return(pot);
        }
Exemplo n.º 2
0
        internal Pot(int id, int tripId, string organizer, PotMode mode, double amount, double targetAmount, string name,
                     DateTime startDate, DateTime endDate, DateTime validityDate, string description, bool isCancelled,
                     string cancellationReason, DateTime?cancellationDate, List <PotUser> participants, DateTime modificationDate)

            : this(id, tripId, organizer, mode, amount, targetAmount, name, startDate, endDate, validityDate,
                   description, isCancelled, cancellationReason, cancellationDate, participants)
        {
            ModificationDate = modificationDate;
        }
Exemplo n.º 3
0
 public Pot(int id, int tripId, string organizer, PotMode mode, double amount, double targetAmount, string name,
            DateTime startDate, DateTime endDate, DateTime validityDate, string description, bool isCancelled,
            string cancellationReason, DateTime?cancellationDate)
     : this()
 {
     Id                 = id;
     TripId             = tripId;
     Organizer          = organizer;
     Mode               = mode;
     CurrentAmount      = amount;
     TargetAmount       = targetAmount;
     Name               = name;
     StartDate          = startDate;
     EndDate            = endDate;
     ValidityDate       = validityDate;
     Description        = description;
     IsCancelled        = isCancelled;
     CancellationReason = cancellationReason;
     CancellationDate   = cancellationDate;
 }
Exemplo n.º 4
0
        public static string PotModeToString(PotMode mode)
        {
            var result = string.Empty;

            switch (mode)
            {
            case PotMode.Lead:
                result = Lead;
                break;

            case PotMode.Shared:
                result = Shared;
                break;

            default:
                break;
            }

            return(result);
        }
 public void PotModeToString_ShouldReturnCorrectStringValue(PotMode mode, string expected)
 {
     Assert.AreEqual(expected, ModelEnumConverter.PotModeToString(mode));
 }
 public void PotModeFromString_ShouldReturnCorrectEnumValue(string mode, PotMode expected)
 {
     Assert.AreEqual(expected, ModelEnumConverter.PotModeFromString(mode));
 }