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;
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
 }
Exemple #4
0
 private void DoSaveShoe(Shoe shoe)
 {
     if (shoe.ID > 0)
     {
         DataContext.UpdateAndAttach(shoe);
     }
     else
     {
         DataContext.InsertOnSubmit(shoe);
     }
     DataContext.Commit();
 }
Exemple #5
0
 private string ShoeAsString(Shoe shoe)
 {
     return shoe == null ? "" : shoe.Brand;
 }
Exemple #6
0
 partial void DeleteShoe(Shoe instance);
Exemple #7
0
 partial void UpdateShoe(Shoe instance);
Exemple #8
0
 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);
     }
 }