public void ResolveCommandQueue() { // Arrange var values = new List <string>() { "Hannah", "Bob", "Frank", "Franchesca", "Zoltan" }; var commandQueue = new CommandQueue(); foreach (var value in values) { commandQueue.AddCommand(new AddToTestCollectionCommand <string>(value)); } var testCollection = new TestCollection <string>(); var testCollectionCommandResolver = new TestCollectionCommandResolver <string>(testCollection); Assert.Empty(testCollection); // Act testCollectionCommandResolver.ProcessCommandQueue(commandQueue); // Assert Assert.Equal(values.Count, testCollection.Count); Assert.Equal(values, testCollection); }
public void ResolveMultipleCommands() { // Setup var values = new List <string>() { "Hannah", "Bob", "Frank", "Franchesca", "Zoltan" }; var testCollection = new TestCollection <string>(); var testCollectionCommandResolver = new TestCollectionCommandResolver <string>(testCollection); Assert.AreEqual(0, testCollection.Count); var commands = new List <ICommand>(); foreach (var value in values) { commands.Add(new AddToTestCollectionCommand <string>(value)); } // Process testCollectionCommandResolver.ProcessCommands(commands); // Assert Assert.AreEqual(values.Count, testCollection.Count); CollectionAssert.AreEqual(values, testCollection); }