static void Main(string[] args) { //Singleton EventBroker EventBroker = new EventBroker(); Product balenciagaShoes = new Product(1, "Red Balenciaga Sneakers"); Console.WriteLine($"Created new product: {balenciagaShoes.ToString()}"); var balenciagaShoesDescriptionQuery = new ProductDescriptionQuery(balenciagaShoes); var productDescription = EventBroker.Query <string>(balenciagaShoesDescriptionQuery); Console.WriteLine($"Product Description from Query is {productDescription}"); EventBroker.Command(new ChangeProductDescriptionCommand(balenciagaShoes, "Black Balenciaga Shoes")); productDescription = EventBroker.Query <string>(balenciagaShoesDescriptionQuery); Console.WriteLine($"New Product Description from Query is {productDescription}"); Console.WriteLine("List of all Events: "); foreach (var e in EventBroker.Events) { Console.WriteLine(e.ToString()); } EventBroker.UndoEvent(); Console.WriteLine("List of all Events: "); foreach (var e in EventBroker.Events) { Console.WriteLine(e.ToString()); } }
void DequeueQueryProducts() { while (m_ProductsToQuery.Count > 0) { ProductDescriptionQuery productDescriptionQuery = m_ProductsToQuery.Dequeue(); if (m_IsConnectedToGoogle) { m_QuerySkuDetailsService.QueryAsyncSku(productDescriptionQuery.products, productDescriptionQuery.onProductsReceived); } else if (m_HasConnectionAttempted) { productDescriptionQuery.onRetrieveProductsFailed(); } } }
/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance ProductDescription mock = CreateMockInstance(tm); bool result = DataRepository.ProductDescriptionProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); ProductDescriptionQuery query = new ProductDescriptionQuery(); query.AppendEquals(ProductDescriptionColumn.ProductDescriptionId, mock.ProductDescriptionId.ToString()); query.AppendEquals(ProductDescriptionColumn.Description, mock.Description.ToString()); query.AppendEquals(ProductDescriptionColumn.Rowguid, mock.Rowguid.ToString()); query.AppendEquals(ProductDescriptionColumn.ModifiedDate, mock.ModifiedDate.ToString()); TList <ProductDescription> results = DataRepository.ProductDescriptionProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }