private void DrawDeck() { //TODO how to draw the deck as this exists within the dealer class? //TODO Should be face down version of all cards in the deck var discardPileVisitor = new DiscardPileVisitor(); _table.Accept(discardPileVisitor); var cards = discardPileVisitor.Result(); var converter = new PileCardDrawingConverter(GraphicsDevice, _spriteBatch); converter.Draw(cards.ToList()); }
public void Accept_ForExistingReservationTheSameDay_ThrowInvalidOperationException(int capacity, List <Reservation> existingReservations, Reservation reservation) { // Arrange var table = new Table(capacity); foreach (var existingReservation in existingReservations) { table.Accept(existingReservation); } // Act & Assert Assert.Throws <InvalidOperationException>(() => table.Accept(reservation)); }
//ExStart //ExFor:Font.Hidden //ExFor:Paragraph.Accept //ExFor:DocumentVisitor.VisitParagraphStart(Aspose.Words.Paragraph) //ExFor:DocumentVisitor.VisitFormField(Aspose.Words.Fields.FormField) //ExFor:DocumentVisitor.VisitTableEnd(Aspose.Words.Tables.Table) //ExFor:DocumentVisitor.VisitCellEnd(Aspose.Words.Tables.Cell) //ExFor:DocumentVisitor.VisitRowEnd(Aspose.Words.Tables.Row) //ExFor:DocumentVisitor.VisitSpecialChar(Aspose.Words.SpecialChar) //ExFor:DocumentVisitor.VisitGroupShapeStart(Aspose.Words.Drawing.GroupShape) //ExFor:DocumentVisitor.VisitShapeStart(Aspose.Words.Drawing.Shape) //ExFor:DocumentVisitor.VisitCommentStart(Aspose.Words.Comment) //ExFor:DocumentVisitor.VisitFootnoteStart(Aspose.Words.Footnote) //ExFor:SpecialChar //ExFor:Node.Accept //ExFor:Paragraph.ParagraphBreakFont //ExFor:Table.Accept //ExSummary:Implements the Visitor Pattern to remove all content formatted as hidden from the document. public void RemoveHiddenContentFromDocument() { // Open the document we want to remove hidden content from. Document doc = new Document(MyDir + "Font.Hidden.doc"); // Create an object that inherits from the DocumentVisitor class. RemoveHiddenContentVisitor hiddenContentRemover = new RemoveHiddenContentVisitor(); // This is the well known Visitor pattern. Get the model to accept a visitor. // The model will iterate through itself by calling the corresponding methods // on the visitor object (this is called visiting). // We can run it over the entire the document like so: doc.Accept(hiddenContentRemover); // Or we can run it on only a specific node. Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 4, true); para.Accept(hiddenContentRemover); // Or over a different type of node like below. Table table = (Table)doc.GetChild(NodeType.Table, 0, true); table.Accept(hiddenContentRemover); doc.Save(MyDir + @"\Artifacts\Font.Hidden.doc"); Assert.AreEqual(13, doc.GetChildNodes(NodeType.Paragraph, true).Count); //ExSkip Assert.AreEqual(1, doc.GetChildNodes(NodeType.Table, true).Count); //ExSkip }
/// <summary> /// Accepts the specified <paramref name="visitor"/> and dispatches calls to the specific visitor /// methods for this object. /// </summary> /// <param name="visitor"> /// The <see cref="ISqlVisitor" /> to visit this object with. /// </param> public override void Accept(ISqlVisitor visitor) { base.Accept(visitor); Table.Accept(visitor); On.Accept(visitor); }
/// <summary> /// Accepts the specified <paramref name="visitor"/> and dispatches calls to the specific visitor /// methods for this object. /// </summary> /// <param name="visitor"> /// The <see cref="ISqlVisitor" /> to visit this object with. /// </param> public override void Accept(ISqlVisitor visitor) { base.Accept(visitor); Table.Accept(visitor); Set.Accept(visitor); Where?.Accept(visitor); }
public void WhenTableReinitialised_PlayersHandStill2Each() { _table.InitialiseHands(); _table.InitialiseHands(); var cardsVisitor = new CardTestVisitor(); _table.Accept(cardsVisitor); Assert.AreEqual(8, cardsVisitor.Count); }
static void Main(string[] args) { var baseTable = new Table("Treasure Table"); baseTable.LoadFromFile(@"..\..\Tables\treasure table.json", new JSONLoader()); var baseTable2 = new Table("Treasure Table"); baseTable.LoadFromFile(@"..\..\Tables\treasure table 2.json", new JSONLoader()); var baseMagicTable = new Table("magic base"); baseMagicTable.LoadFromFile(@"..\..\Tables\magic base.json", new JSONLoader()); var printTree = new PrintEntireTreeVisitor(); baseTable.Accept(printTree); Console.WriteLine("\r\n===================\r\n"); baseTable2.Accept(printTree); //baseMagicTable.Accept(printTree); baseTable.RollCount = 100; Console.WriteLine("\r\n===================\r\n"); var lootBag = new GetLootVisitor(); var lootBag2 = new GetLootVisitor(); baseTable.Accept(lootBag); foreach (Component comp in lootBag.GetLootBag()) { Console.WriteLine(comp); } Console.ReadLine(); }
public void RemoveHiddenContentFromDocument() { //ExStart //ExFor:Font.Hidden //ExFor:Paragraph.Accept //ExFor:DocumentVisitor.VisitParagraphStart(Aspose.Words.Paragraph) //ExFor:DocumentVisitor.VisitFormField(Aspose.Words.Fields.FormField) //ExFor:DocumentVisitor.VisitTableEnd(Aspose.Words.Tables.Table) //ExFor:DocumentVisitor.VisitCellEnd(Aspose.Words.Tables.Cell) //ExFor:DocumentVisitor.VisitRowEnd(Aspose.Words.Tables.Row) //ExFor:DocumentVisitor.VisitSpecialChar(Aspose.Words.SpecialChar) //ExFor:DocumentVisitor.VisitGroupShapeStart(Aspose.Words.Drawing.GroupShape) //ExFor:DocumentVisitor.VisitShapeStart(Aspose.Words.Drawing.Shape) //ExFor:DocumentVisitor.VisitCommentStart(Aspose.Words.Comment) //ExFor:DocumentVisitor.VisitFootnoteStart(Aspose.Words.Footnote) //ExFor:SpecialChar //ExFor:Node.Accept //ExFor:Paragraph.ParagraphBreakFont //ExFor:Table.Accept //ExSummary:Implements the Visitor Pattern to remove all content formatted as hidden from the document. // Open the document we want to remove hidden content from. Document doc = new Document(MyDir + "Font.Hidden.doc"); // Create an object that inherits from the DocumentVisitor class. RemoveHiddenContentVisitor hiddenContentRemover = new RemoveHiddenContentVisitor(); // This is the well known Visitor pattern. Get the model to accept a visitor. // The model will iterate through itself by calling the corresponding methods // on the visitor object (this is called visiting). // We can run it over the entire the document like so: doc.Accept(hiddenContentRemover); // Or we can run it on only a specific node. Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 4, true); para.Accept(hiddenContentRemover); // Or over a different type of node like below. Table table = (Table)doc.GetChild(NodeType.Table, 0, true); table.Accept(hiddenContentRemover); doc.Save(MyDir + @"\Artifacts\Font.Hidden.doc"); Assert.AreEqual(13, doc.GetChildNodes(NodeType.Paragraph, true).Count); //ExSkip Assert.AreEqual(1, doc.GetChildNodes(NodeType.Table, true).Count); //ExSkip }
public void TestBoutiqueRestaurant(int capacity, List <Reservation> existingReservations, Reservation reservation, bool expected) { // Arrange var table = new Table(capacity); foreach (var existingReservation in existingReservations) { table.Accept(existingReservation); } // Act var actual = table.CanAccept(reservation); // Assert actual.Should().Be(expected); }
public void Visit() { var table = new Table(players: 3); table.InitialiseHands(); var playerVisitor = new PlayerVisitor(); table.Accept(playerVisitor); var players = playerVisitor.Result(); Assert.AreEqual(3, players.Keys.Count); Assert.AreEqual(2, players.First().Value.Count); foreach (var player in players) { Console.WriteLine($"{player.Key.InGame}"); player.Value.ForEach(v => Console.WriteLine($"{v.Suit} {v.Value} {v.Color}")); } }