public CardViewModel(Card model) { Name = model.Name; Description = model.Description; Id = model.Id; PinItems = model.Pins.Select(p => new PinItemViewModel(p)).ToList(); }
public void CardPropertiesAreStoredInCardViewModelProperties() { var card = new Card { Description = "description", Name = "name", Id = 1, Pins = new List<string>() }; for (var i = 0; i < PINS_NUMBER; i++) { card.Pins.Add(i.ToString(CultureInfo.InvariantCulture)); } var target = new CardViewModel(card); Assert.AreEqual(card.Name, target.Name); Assert.AreEqual(card.Description, target.Description); Assert.AreEqual(card.Id, target.Id); var index = 0; foreach (var pinItem in target.PinItems) { Assert.AreEqual(card.Pins[index], pinItem.Pin); index++; } }
private Card GetCard() { var c = new Card { Id = 1, Name = "name", Description = "desc", Pins = new List<string>() }; for (int i = 0; i < 20; i++) { c.Pins.Add(i.ToString(CultureInfo.InvariantCulture)); } return c; }
public int CreateTestData() { var token = DateTime.Now.Millisecond; var cards = _cardProvider.LoadCards().ToList(); foreach (var index in Enumerable.Range(0,5)) { var card =new Card { Description = "test bank description", Name = "ABN AMRO"+ index, Id = index + token, Pins = new List<string>(20) }; for (var i = 0; i < 20; i++) { card.Pins.Add(i.ToString(CultureInfo.InvariantCulture)); } cards.Add(card); } _cardProvider.UpdateList(cards); return cards.Count; }