public void ShuffleCards_ShouldReturn52CountOfCards() { //arrange var expectedResult = 52; var cardBusiness = new CardBusiness(); //act var result = cardBusiness.ShuffleCards().Count(); //assert result.Should().Equals(expectedResult); }
public void ShuffleCards_ShouldNotThrowException_WhenReturn52CountOfCards() { //arrange var expectedResult = 52; _moq.Card.Setup(a => a.GetCardType(It.IsAny <Enumerations.CardTypeEnum>())).Returns(It.IsAny <string>()); var cardBusiness = new CardBusiness(_moq.Card.Object); //act var result = cardBusiness.ShuffleCards().Count(); //assert result.Should().Equals(expectedResult); }
public void Edit(Card card) { using (var db = new TrelloModelDBContainer()) { List <KeyValuePair <CardValidationCodes, KeyValuePair <string, string> > > errorMsgDic; if (CardBusiness.ValidateCard(card, out errorMsgDic)) { db.EditCard(card.CardId, card.Cix, card.Name, card.Discription, card.DueDate, card.ListId); } else { throw new DbEntityValidationException("Card validation error"); } } }
protected override DbEntityValidationResult ValidateEntity(DbEntityEntry entityEntry, IDictionary <object, object> items) { items = new Dictionary <object, object>(); if (entityEntry.Entity is Board) { List <KeyValuePair <BoardValidationCodes, KeyValuePair <string, string> > > errorMsgDic; if (!BoardBusiness.ValidateBoard((Board)entityEntry.Entity, Board.ToList(), out errorMsgDic)) { var list = new List <DbValidationError>(); foreach (var err in errorMsgDic) { list.Add(new DbValidationError(err.Value.Key, err.Value.Value)); items.Add(err.Key, err.Value); } return(new DbEntityValidationResult(entityEntry, list)); } } if (entityEntry.Entity is List) { List <KeyValuePair <ListValidationCodes, KeyValuePair <string, string> > > errorMsgDic; if (!ListBusiness.ValidateList((List)entityEntry.Entity, out errorMsgDic)) { var list = new List <DbValidationError>(); foreach (var err in errorMsgDic) { list.Add(new DbValidationError(err.Value.Key, err.Value.Value)); items.Add(err.Key, err.Value); } return(new DbEntityValidationResult(entityEntry, list)); } } if (entityEntry.Entity is Card) { List <KeyValuePair <CardValidationCodes, KeyValuePair <string, string> > > errorMsgDic; if (!CardBusiness.ValidateCard((Card)entityEntry.Entity, out errorMsgDic)) { var list = new List <DbValidationError>(); foreach (var err in errorMsgDic) { list.Add(new DbValidationError(err.Value.Key, err.Value.Value)); items.Add(err.Key, err.Value); } return(new DbEntityValidationResult(entityEntry, list)); } } return(base.ValidateEntity(entityEntry, items)); }
public BaseController() : base() { loginBusiness = new LoginBusiness(this.GetContext()); batchBusiness = new BatchBusiness(this.GetContext()); cardBusiness = new CardBusiness(this.GetContext()); requestBusiness = new RequestBusiness(this.GetContext()); newsBusiness = new NewsBusiness(this.GetContext()); cusBusiness = new CustomerBusiness(this.GetContext()); rankBusiness = new RankBusiness(this.GetContext()); configBusiness = new ConfigBusiness(this.GetContext()); pointBusiness = new PointBusiness(this.GetContext()); warrantyBusiness = new WarrantyBusiness(this.GetContext()); statisticBus = new StatisticBusiness(this.GetContext()); orderBus = new OrderBusiness(this.GetContext()); userBusiness = new UserBusiness(this.GetContext()); itemBusiness = new ItemBusiness(this.GetContext()); productsBusiness = new ItemBusiness(this.GetContext()); notifyBusiness = new NotifyBusiness(this.GetContext()); shopBusiness = new ShopBusiness(this.GetContext()); agentBusiness = new AgentBusiness(this.GetContext()); vnpay = new VNPay(this.GetContext()); }