Exemplo n.º 1
0
 public void NetworkCardObject()
 {
     var networkObj = new NetworkCardObject(ServerCommands.AnnounceCard, new CardBallotNo(), new CardBallotYes(), new CardPolicyVeto(), new CardPolicyLiberal());
     var decoder = new NetworkCardObject.CardObjectReader();
     var bytes = decoder.GenerateByteStream(networkObj);
     var generatedObj = decoder.GenerateObject(bytes, false);
     Assert.IsInstanceOfType(generatedObj, typeof(NetworkCardObject));
     var generatedCardObj = generatedObj as NetworkCardObject;
     Assert.IsTrue(generatedCardObj.Cards.Length == networkObj.Cards.Length);
     for(var i = 0; i < generatedCardObj.Cards.Length; i++)
         Assert.AreSame(generatedCardObj.Cards[i].GetType(), networkObj.Cards[i].GetType());
     CompareDefaultObject(networkObj, generatedCardObj);
 }