private static Accrual CreateAccrualInstance(AccrualFrequency frequency, Ending ending, int?dayOfPayA = null, int?dayOfPayB = null) { var accrual = new Accrual( accrualId: Guid.Parse("34bb297c-630e-4036-84c6-8925eaa88f80"), name: "Test Name", userId: "unittest|784734738", startingHours: 50, maxHours: 255, accrualRate: 10, accrualFrequency: frequency, dayOfPayA: dayOfPayA, dayOfPayB: dayOfPayB, startingDate: new DateTime(2018, 12, 1), ending: ending, isHeart: false, isArchived: false, minHours: 40, lastModified: new DateTime(2018, 10, 10, 3, 1, 12, 154), hourlyRate: 15, actions: new List <AccrualActionRecord> { new AccrualActionRecord("c153da22-6df0-4fab-8069-7ef52946c635", AccrualAction.Created, null, null, null, new DateTime(2018, 10, 10)), new AccrualActionRecord("e74f6d32-7ca8-4d6c-beab-89a6ff18aec3", AccrualAction.Adjustment, new DateTime(2018, 12, 3), 8, "jury duty 12/3/18", new DateTime(2018, 10, 10)), new AccrualActionRecord("1fdfb091-0c99-4141-8943-82df48759ebd", AccrualAction.Adjustment, new DateTime(2018, 12, 4), 8, "jury duty 12/4/18", new DateTime(2018, 10, 10)), new AccrualActionRecord("912304e3-ac13-4782-aa19-1be009ef164f", AccrualAction.Adjustment, new DateTime(2018, 12, 5), 8, "jury duty 12/5/18", new DateTime(2018, 10, 10)), new AccrualActionRecord("2badfd74-d3ee-435a-88c9-4a5f604cfca2", AccrualAction.Adjustment, new DateTime(2018, 12, 25), 8, "christmas 2018", new DateTime(2018, 10, 10)), }); return(accrual); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (FeeType != null) { hashCode = hashCode * 59 + FeeType.GetHashCode(); } if (Amount != null) { hashCode = hashCode * 59 + Amount.GetHashCode(); } if (BalanceRate != null) { hashCode = hashCode * 59 + BalanceRate.GetHashCode(); } if (TransactionRate != null) { hashCode = hashCode * 59 + TransactionRate.GetHashCode(); } if (AccruedRate != null) { hashCode = hashCode * 59 + AccruedRate.GetHashCode(); } if (AccrualFrequency != null) { hashCode = hashCode * 59 + AccrualFrequency.GetHashCode(); } if (Currency != null) { hashCode = hashCode * 59 + Currency.GetHashCode(); } if (AdditionalValue != null) { hashCode = hashCode * 59 + AdditionalValue.GetHashCode(); } if (AdditionalInfo != null) { hashCode = hashCode * 59 + AdditionalInfo.GetHashCode(); } if (AdditionalInfoUri != null) { hashCode = hashCode * 59 + AdditionalInfoUri.GetHashCode(); } if (Discounts != null) { hashCode = hashCode * 59 + Discounts.GetHashCode(); } return(hashCode); } }
public void one_month_biweekly_generates_success(AccrualFrequency frequency, Ending ending, int expectedRows, int?dayOfPayA, int?dayOfPayB) { // arrange var dnp = new Mock <IDotNetProvider>(); dnp.Setup(_ => _.DateTimeNow).Returns(new DateTime(2018, 10, 11)); var config = CreateAccrualInstance(frequency, ending, dayOfPayA, dayOfPayB); // act var service = new AccrualService(dnp.Object); var rows = service.Calculate(config); // assert Assert.IsNotNull(rows); Assert.AreEqual(expectedRows, rows.Count); Console.WriteLine(JsonConvert.SerializeObject(rows, Formatting.Indented)); }
public Accrual(Guid accrualId, string userId, string name, double startingHours, double accrualRate, DateTime startingDate, AccrualFrequency accrualFrequency, Ending ending, DateTime lastModified, bool isHeart, bool isArchived, decimal?hourlyRate, int?dayOfPayA, int?dayOfPayB, double?minHours, double?maxHours, List <AccrualActionRecord> actions) { AccrualId = accrualId; UserId = userId; Name = name; StartingHours = startingHours; AccrualRate = accrualRate; StartingDate = startingDate; AccrualFrequency = accrualFrequency; Ending = ending; LastModified = lastModified; IsHeart = isHeart; IsArchived = isArchived; HourlyRate = hourlyRate; DayOfPayA = dayOfPayA; DayOfPayB = dayOfPayB; MinHours = minHours; MaxHours = maxHours; Actions = actions ?? new List <AccrualActionRecord>(); }
/// <summary> /// Returns true if BankingProductFee instances are equal /// </summary> /// <param name="other">Instance of BankingProductFee to be compared</param> /// <returns>Boolean</returns> public bool Equals(BankingProductFee other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( FeeType == other.FeeType || FeeType != null && FeeType.Equals(other.FeeType) ) && ( Amount == other.Amount || Amount != null && Amount.Equals(other.Amount) ) && ( BalanceRate == other.BalanceRate || BalanceRate != null && BalanceRate.Equals(other.BalanceRate) ) && ( TransactionRate == other.TransactionRate || TransactionRate != null && TransactionRate.Equals(other.TransactionRate) ) && ( AccruedRate == other.AccruedRate || AccruedRate != null && AccruedRate.Equals(other.AccruedRate) ) && ( AccrualFrequency == other.AccrualFrequency || AccrualFrequency != null && AccrualFrequency.Equals(other.AccrualFrequency) ) && ( Currency == other.Currency || Currency != null && Currency.Equals(other.Currency) ) && ( AdditionalValue == other.AdditionalValue || AdditionalValue != null && AdditionalValue.Equals(other.AdditionalValue) ) && ( AdditionalInfo == other.AdditionalInfo || AdditionalInfo != null && AdditionalInfo.Equals(other.AdditionalInfo) ) && ( AdditionalInfoUri == other.AdditionalInfoUri || AdditionalInfoUri != null && AdditionalInfoUri.Equals(other.AdditionalInfoUri) ) && ( Discounts == other.Discounts || Discounts != null && Discounts.SequenceEqual(other.Discounts) )); }