public TruckModel(Truck truck)
 {
     this.Id = truck.Id;
     this.Title = string.Format("{0} {1} {2}", truck.Year, truck.Make, truck.Model);
     this.Img = truck.PreviewImageUrl ?? string.Empty;
     this.List = truck.StickerPrice.ToString("C");
     this.Location = truck.Location != null ? truck.Location.ToString() : string.Empty;
     this.Pros = truck.PositiveNotes != null ? truck.PositiveNotes.ToList() : new List<string>();
     this.Cons = truck.NegativeNotes != null ? truck.NegativeNotes.ToList() : new List<string>();
     this.Mileage = truck.Mileage.ToString();
     this.Link = truck.SourceUrl;
 }
 public void Truck_Is_Add_To_System()
 {
     var t = new Truck()
     {
         Make = "Ford",
         Model = "F350",
         Year = 2003,
         Trim = "XLT"
     };
     var added = _service.AddToAvailable(t) as Truck;
     Assert.True(added != null && !string.IsNullOrEmpty(added.Id) && added.Id.Length > 1);
 }
        public void Truck_Status_Is_Set_To_Active()
        {
            var unique = Guid.NewGuid().ToString();
            var t = new Truck()
            {
                Make = "Ford",
                Model = unique,
                Year = 2003,
                Trim = "XLT"
            };
            var added = _service.AddToAvailable(t) as Truck;
            var addedTruck = _service.GetTruckById(added.Id) as Truck;

            Assert.True(addedTruck.IsContender);
        }
 public void Truck_Retreived_After_Add()
 {
     var unique = Guid.NewGuid().ToString();
     var t = new Truck()
     {
         Make = "Ford",
         Model = unique,
         Year = 2003,
         Trim = "XLT"
     };
     var added = _service.AddToAvailable(t) as Truck;
     var addedTruck = _service.GetTruckById(added.Id) as Truck;
     Assert.NotNull(addedTruck);
     Assert.Equal(t.Model, addedTruck.Model);
 }
        public void A_New_Truck_Is_Returned_In_Available_List()
        {
            var unique = Guid.NewGuid().ToString();
            var t = new Truck()
            {
                Make = "Ford",
                Model = unique,
                Year = 2003,
                Trim = "XLT"
            };
            var added = _service.AddToAvailable(t) as Truck;

            var list = _service.GetAvailableList(new ProjectTruckMember() { Id = 0, Username = "******" }) as List<Truck>;

            var match = list.FirstOrDefault(m => m.Model == added.Model);
            Assert.NotNull(match);
        }
        public void Available_List_Contains_Only_Available()
        {
            var unique = Guid.NewGuid().ToString();
            var t = new Truck()
            {
                Make = "Ford",
                Model = unique,
                Year = 2003,
                Trim = "XLT"
            };
            var added = _service.AddToAvailable(t) as Truck;

            var list = _service.GetAvailableList(new ProjectTruckMember() { Id = 0, Username = "******" }) as List<Truck>;

            var isAny = list.Where(m => !m.IsContender);
            Assert.False(isAny.Any());
        }