public void TheYear_x_uses_that_year_to_make_dates() { var months = The.Year(1999); var date = months.On.January.The(1); date.Year.ShouldBe(1999); }
public void TheYear_x_uses_that_year_to_make_dates() { var months = The.Year(1999); var date = months.On.January.The(1); Assert.That(date.Year, Is.EqualTo(1999)); }
public void Using_full_syntax() { var product = Builder <Product> .CreateNew() .With(x => x.Created = The.Year(2008).On.January.The10th.At(05, 49, 38)) .Build(); Assert.That(product.Created, Is.EqualTo(new DateTime(2008, 01, 10, 05, 49, 38))); }
public void Using_full_syntax() { var builderSetup = new BuilderSettings(); var product = new Builder(builderSetup).CreateNew <Product>() .With(x => x.Created = The.Year(2008).On.January.The10th.At(05, 49, 38)) .Build(); product.Created.ShouldBe(new DateTime(2008, 01, 10, 05, 49, 38)); }
public void ParseCsv_FromCsv_CreateMovement_Income() { var line = "Banca,2/1/2012,ricarica-cellulare,,15 €"; IMovement ex = Movement.Parse(line); Assert.AreEqual(The.Year(2012).On.February.The1st, ex.Date); Assert.AreEqual(15, ex.Value); }
public void ParseCsv_FromCsv_DateFormat_ddMMMyy_MustBeParsed() { var line = "Banca,17 Gen 12,ricarica-cellulare,,15 €"; IMovement ex = Movement.Parse(line); var expected = The.Year(2012).On.January.The17th; Assert.AreEqual(expected, ex.Date); }
public void Fluent_dates_example() { var product = Builder <Product> .CreateNew() .With(x => x.Created = The.Year(2006).On.May.The10th.At(09, 00)) .With(x => x.LastEdited = On.August.The15th.At(15, 43)) .Build(); Assert.That(product.Created, Is.EqualTo(new DateTime(2006, 5, 10, 09, 00, 00))); Assert.That(product.LastEdited, Is.EqualTo(new DateTime(DateTime.Now.Year, 8, 15, 15, 43, 00))); }
public void GetBalances_ForEachDay_StartingFrom_MustReturns_Balances() { Account account = new Account(); account.AddIncome(new Income(100, The.Year(2012).On.January.The1st)); account.AddExpense(new Expense(80, The.Year(2012).On.January.The1st)); List <PartialBalance> balances = account.GetBalances(ForEach.Day.StartingFrom(The.Year(2012).On.January.The1st)); Assert.AreEqual(20, balances.ElementAt(0).Balance); }
public void Fluent_dates_example() { var builderSetup = new BuilderSettings(); var product = new Builder(builderSetup) .CreateNew <Product>() .With(x => x.Created = The.Year(2006).On.May.The10th.At(09, 00)) .With(x => x.LastEdited = On.August.The15th.At(15, 43)) .Build(); product.Created.ShouldBe(new DateTime(2006, 5, 10, 09, 00, 00)); product.LastEdited.ShouldBe(new DateTime(DateTime.Now.Year, 8, 15, 15, 43, 00)); }
public void ForEach_Create_Monthly_Periods_StartingFrom_10thOfMont() { ForEach fe = ForEach.Month.StartingFrom(The.Year(2012).On.January.The10th); List <Period> periods = fe.GetPeriods(); Assert.AreEqual(12, periods.Count); Assert.AreEqual(1, periods[0].From.Month); Assert.AreEqual(2, periods[0].To.Month); Assert.AreEqual(10, periods[0].From.Day); Assert.AreEqual(9, periods[0].To.Day); Assert.AreEqual(10, periods[1].From.Day); Assert.AreEqual(9, periods[1].To.Day); }
public void ImportFromCsv_MustAdd_TheMovement() { Account account = new Account(); account.ImportFromCsv("Banca,2/1/2012,ricarica-cellulare,,-15 €"); Assert.AreEqual(The.Year(2012).On.February.The1st, account.Movements.ElementAt(0).Date); Assert.AreEqual(-15, account.Movements.ElementAt(0).Value); Assert.IsTrue(account.Movements.ElementAt(0).Tags.Contains("ricarica-cellulare")); account.ImportFromCsv("Banca,01 Ago 12,mangiare uscite,happy hour sannabar,\"-4 €\""); Assert.AreEqual(The.Year(2012).On.August.The1st, account.Movements.ElementAt(1).Date); Assert.AreEqual(-4, account.Movements.ElementAt(1).Value); Assert.IsTrue(account.Movements.ElementAt(1).Tags.Contains("mangiare")); Assert.IsTrue(account.Movements.ElementAt(1).Tags.Contains("uscite")); }
public void GetBalances_ForEachMonth_StartingFrom_MustReturns_Balances() { Account account = new Account(); account.AddIncome(new Income(100, The.Year(2012).On.January.The1st)); account.AddExpense(new Expense(80, The.Year(2012).On.January.The1st)); account.AddIncome(new Income(1000, The.Year(2012).On.April.The1st)); account.AddExpense(new Expense(600, The.Year(2012).On.August.The1st)); List <PartialBalance> balances = account.GetBalances(ForEach.Month.StartingFrom(The.Year(2012).On.January.The1st)); Assert.AreEqual(12, balances.Count()); Assert.AreEqual(20, balances.ElementAt(0).Balance); Assert.AreEqual(1000, balances.ElementAt(3).Balance); Assert.AreEqual(-600, balances.ElementAt(7).Balance); }
public void ForEach_Create_Daily_Recurrency() { ForEach fe = ForEach.Day.StartingFrom(The.Year(2012).On.January.The1st); List <Period> periods = fe.GetPeriods(); Assert.AreEqual(1, periods[0].From.Day); Assert.AreEqual(1, periods[0].From.Month); Assert.AreEqual(2012, periods[0].From.Year); Assert.AreEqual(2, periods[1].From.Day); Assert.AreEqual(1, periods[1].From.Month); Assert.AreEqual(2012, periods[1].From.Year); Assert.AreEqual(31, periods.Last().From.Day); Assert.AreEqual(12, periods.Last().From.Month); Assert.AreEqual(2012, periods.Last().From.Year); }
public void GetBalanceInPeriod_MustReturn_BalanceOfperiod() { Account account = new Account(); // movements in range account.AddIncome(new Income(1200, The.Year(2012).On.January.The10th)); account.AddExpense(new Expense(5, The.Year(2012).On.January.The15th)); account.AddExpense(new Expense(400, The.Year(2012).On.January.The30th)); account.AddExpense(new Expense(120, The.Year(2012).On.February.The4th)); account.AddIncome(new Income(100, The.Year(2012).On.February.The6th)); // some movement extra range. Must be skipped account.AddExpense(new Expense(120, The.Year(2012).On.April.The4th)); account.AddIncome(new Income(100, The.Year(2012).On.April.The6th)); var from = The.Year(2012).On.January.The10th; var to = The.Year(2012).On.February.The9th; double balance = account.GetBalanceInPeriod(from, to); Assert.AreEqual(1200 - 5 - 400 - 120 + 100, balance); }
public void Dates_1() { The.Year(2006).On.May.The10th.At(09, 00); On.July.The21st.At(07, 00); var aug11 = August.The11th; July.The(1); November.The(10); The.Year(2008).On.January.The10th.At(05, 49, 38); var created = On.May.The14th; Today.At(09, 00); // (These generate TimeSpans) The.Time(08, 31); At.Time(09, 46); }
public static List <EmployeeEntity> BuildEmployees() { var cornelBrody = new EmployeeEntity { Firstname = "Cornel", LastName = "Brody", BirthDate = The.Year(1956).On.May.The10th, HireDate = The.Year(1999).On.February.The15th, Roles = EmployeeRoles.Manager, Email = "*****@*****.**", Manager = null }; var mihaiBarabas = new EmployeeEntity { Firstname = "Mihai", LastName = "Barabas", BirthDate = The.Year(1978).On.July.The7th, HireDate = The.Year(2004).On.August.The21st, Roles = EmployeeRoles.Manager | EmployeeRoles.Executive, Email = "*****@*****.**", Manager = cornelBrody }; var cosminMolnar = new EmployeeEntity { Firstname = "Cosmin", LastName = "Molnar", BirthDate = The.Year(1975).On.January.The24th, HireDate = The.Year(2012).On.May.The13th, Roles = EmployeeRoles.Manager | EmployeeRoles.Executive, Email = "*****@*****.**", Manager = cornelBrody }; return(new List <EmployeeEntity> { cornelBrody, mihaiBarabas, cosminMolnar, new EmployeeEntity { Firstname = "Hr", LastName = "Generic", BirthDate = The.Year(1900).On.January.The1st, HireDate = The.Year(2012).On.May.The13th, Roles = EmployeeRoles.Hr, Email = "*****@*****.**", Manager = null, }, new EmployeeEntity { Firstname = "Daniel", LastName = "Savu", BirthDate = The.Year(1980).On.December.The12th, HireDate = The.Year(2012).On.May.The13th, Roles = EmployeeRoles.Executive, Email = "*****@*****.**", Manager = mihaiBarabas, }, new EmployeeEntity { Firstname = "Costin", LastName = "Morariu", BirthDate = The.Year(1977).On.July.The4th, HireDate = The.Year(2012).On.May.The13th, Roles = EmployeeRoles.Executive, Email = "*****@*****.**", Manager = mihaiBarabas, }, new EmployeeEntity { Firstname = "Ioana", LastName = "Sandu", BirthDate = The.Year(1983).On.March.The20th, HireDate = The.Year(2012).On.May.The13th, Roles = EmployeeRoles.Hr | EmployeeRoles.Executive, Email = "*****@*****.**", Manager = cosminMolnar, }, }); }
public ForEach() { this.StartDay = The.Year(DateTime.Now.Year).On.January.The1st; }