Esempio n. 1
0
 public static IEnumerable<NewThing> FromOldThing(Thing oldThing)
 {
     var results = new List<NewThing>
     {
         new NewThing
         {
             Id = oldThing.Id,
             DateType = "Foo",
             Date = oldThing.FooDate
         },
         new NewThing
         {
             Id = oldThing.Id,
             DateType = "Bar",
             Date = oldThing.BarDate
         },
         new NewThing
         {
             Id = oldThing.Id,
             DateType = "Widget",
             Date = oldThing.WidgetDate
         }
     };
     return results;
 }
        public ThingRepository()
        {
            var random = new Random();

            for (var x = 0; x < 10; x++)
            {
                var thing = new Thing
                {
                    Id = x + 1,
                    BarDate = DateTime.Now.AddDays(-1*random.Next(1, 1000)),
                    FooDate = DateTime.Now.AddDays(-1*random.Next(1, 1000)),
                    WidgetDate = DateTime.Now.AddDays(-1*random.Next(1, 1000))
                };
                
                _things.Add(thing);
            }
        }