public Run Build() { var date = new DateTime(2010, 1, 30, 12, 25, 7); var shoe = new Shoe { Brand = "Nike" }; var run = new Run { ID=1, Distance = 10000, Labels = (int)LabelEnumeration.None, LastChanged = date, Start = date, Shoe = shoe, Time = 10000 }; return run; }
public void AssertCanConvertRunToCsv() { var date = new DateTime(2010, 1, 30, 12, 25, 7); var shoe = new Shoe {Brand = "Nike"}; var run = new Run { Distance = 10000, Labels = (int) LabelEnumeration.None, LastChanged = date, Start = date, Shoe = shoe, Time = 10000 }; var e = new CsvData(); var content = e.AsFileContent(new[] {run}); var expected = "Time\tDistance\tShoe\tRegisteredAt\tLastChanged\tLabels\r\n10000\t10000\tNike\t30-1-2010 12:25:07\t30-1-2010 12:25:07\t\r\n"; Assert.AreEqual(expected,content); }
public void SaveShoe(Shoe shoe) { var message = string.Format("saveshoe, shoe ID = {0}, AthleteID = {1}", shoe.ID, shoe.AthleteID); DataContext.RollbackAndAttach(shoe.Athlete); DoSaveShoe(shoe); }
private void DoSaveShoe(Shoe shoe) { if (shoe.ID > 0) { DataContext.UpdateAndAttach(shoe); } else { DataContext.InsertOnSubmit(shoe); } DataContext.Commit(); }
private string ShoeAsString(Shoe shoe) { return shoe == null ? "" : shoe.Brand; }
partial void DeleteShoe(Shoe instance);
partial void UpdateShoe(Shoe instance);
partial void InsertShoe(Shoe instance);
private void BuildAndInsert10ActiveShoes(Athlete athlete) { for (var idx = 0; idx < 10; idx++) { var shoe = new Shoe {Athlete = athlete,Active = true}; MemoryDataContext.InsertOnSubmit(shoe); } }