public void CreateNewCardWithNullIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(nullId); Assert.IsNotNull(card); }
public void CutDeckWithValidIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.Cut(validId); Assert.IsNotNull(ret); }
public void ReturnDeckWithNullIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.ReturnDeck(nullId); Assert.IsNull(ret); }
public void PopDeckWithNullIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.Pop(nullId); Assert.IsTrue(ret == -1); }
public void PopDeckWithValidIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.Pop(validId); Assert.IsTrue(ret >= 0 && ret < Card.NumberOfCardsInDeck); }
public void ShuffleDeckWithInValidIdTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.Shuffle(invalidId); Assert.IsNull(ret); }
public void CutDeckWithNullIdInValidOffsetTest() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = card_controller.Cut(nullId, invalidOffset); Assert.IsNull(ret); }
public void CreateCard_ShouldReturnViewResult() { // Arrange var mockWallet = new Mock <IWalletWebService>(); var mockCard = new Mock <ICardWebService>(); CardController controller = new CardController(mockCard.Object, mockWallet.Object); // Act var result = controller.Create(1); // Assert Assert.That(result, Is.TypeOf <ViewResult>()); }
public void PopDeckWithValidIdTest2() { InitAppSettings(); var card_controller = new CardController(); var card = card_controller.Create(validId); var ret = -1; for (int i = 0; i <= Card.NumberOfCardsInDeck; i++) { ret = card_controller.Pop(validId); } Assert.IsTrue(ret == -1); }
// TODO : Animation public void AddCardToHand(BaseCard card) { if (Hand.Count < MaxCardsInHand) { card.Controller = CardController.Create(card); Hand.Add(card); } else { // TODO : Destroy card because hand is full } // Updating the Player glows UpdateSprites(); }
public void CreateCard_Test() { var service = new Mock <CardService>(); var fakeCard = new Mock <CardCreateDto>(); // Arrange service.Setup(x => x.Create(fakeCard.Object)) .Returns(new CardDto()); // Act var controller = new CardController(service.Object, new Mock <OrderService>().Object); var result = controller.Create(fakeCard.Object); // Assert Assert.IsType <OkResult>(result); }
public async Task CreateCard_ShouldCallCreateCardInBlOnce() { //Arrange CardViewModel cardVM = new CardViewModel { Description = "Description", }; var mockWallet = new Mock <IWalletWebService>(); var mockCard = new Mock <ICardWebService>(); CardController controller = new CardController(mockCard.Object, mockWallet.Object); mockCard.Setup(x => x.Create(It.IsAny <CardViewModel>())).ReturnsAsync(It.IsAny <CardViewModel>()); //Act await controller.Create(cardVM); //Assert mockCard.Verify(x => x.Create(It.IsAny <CardViewModel>()), Times.Once); }
public BaseCard DrawFromDeck(BaseCard card) { if (Deck.Contains(card)) { if (Hand.Count < MaxCardsInHand) { // Moving the card to the Hand Hand.Add(card); Deck.Remove(card); // Creating the visual controller for the card CardController cardController = CardController.Create(card); card.Controller = cardController; // Adding the Cardcontroller to the HandController HandController.Add(cardController); // Firing OnDrawn events card.OnDrawn(); EventManager.Instance.OnCardDrawn(this, card); // Updating the Player glows UpdateSprites(); return(card); } else { // TODO : Discard the card // Updating the Player glows UpdateSprites(); } } return(null); }