/// <summary> /// Creates an expense with specified, or random values. /// </summary> /// <param name="splitwiseContext">The Splitwise context.</param> /// <param name="id">The identifier.</param> /// <param name="description">The description.</param> /// <param name="date">The date.</param> /// <param name="isDeleted">A value indicating if the expense is deleted.</param> /// <param name="updatedAt">The updated at timestamp.</param> /// <param name="paidAmount">The paid amount.</param> /// <param name="personalAmount">The personal amount.</param> /// <param name="splits">The splits.</param> /// <returns>The created expense.</returns> public static Expense GenerateExpense( this SplitwiseContextMock splitwiseContext, int id = 0, string description = null, LocalDate?date = null, bool isDeleted = false, DateTime?updatedAt = null, decimal paidAmount = 10, decimal personalAmount = 5, List <Split> splits = null) { var expense = new Expense { Id = id, Description = description ?? GetRandomString(), Date = date ?? DateTime.Today.ToLocalDate(), IsDeleted = isDeleted, UpdatedAt = updatedAt ?? DateTime.Now, PaidAmount = paidAmount, PersonalAmount = personalAmount, Splits = splits ?? new List <Split>(), }; splitwiseContext.Expenses.Add(expense); return(expense); }
/// <summary> /// Creates a user with specified, or random values. /// </summary> /// <param name="splitwiseContext">The Splitwise context.</param> /// <param name="id">The identifier.</param> /// <param name="firstName">The first name.</param> /// <param name="lastName">The last name.</param> /// <returns>The created expense.</returns> public static User GenerateUser( this SplitwiseContextMock splitwiseContext, int id = 0, string firstName = null, string lastName = null) { var user = new User { Id = id, FirstName = firstName ?? GetRandomString(), LastName = lastName, }; splitwiseContext.Users.Add(user); return(user); }