public List <PurchaseDataRecieve> PullAllPurchasesData() { Task.Delay(TimeSpan.FromSeconds(10)).Wait(); List <PurchaseDataRecieve> purchasesDataRecieve = new List <PurchaseDataRecieve>(); string query = $"{ConfigManager.DbPullAllQuery}"; MySqlCommand cmd = new MySqlCommand(query, Connection); OpenConnection(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { PurchaseDataRecieve purchaseDataRecieve = new PurchaseDataRecieve(); purchaseDataRecieve.PurchaseId = reader[ConfigManager.PurchaseIdDb].ToString(); purchaseDataRecieve.StoreType = char.Parse(reader[ConfigManager.StoreTypeDb].ToString()); purchaseDataRecieve.StoreId = reader[ConfigManager.StoreIdDb].ToString(); purchaseDataRecieve.ActivityDays = char.Parse(reader[ConfigManager.ActivityDaysDb].ToString()); purchaseDataRecieve.CreditCardNumber = reader[ConfigManager.CreditCardDb].ToString(); purchaseDataRecieve.PurchaseDate = reader[ConfigManager.PurchaseDateDb].ToString(); purchaseDataRecieve.DbAddDate = DateTime.Parse(reader[ConfigManager.AddedToDb].ToString()); purchaseDataRecieve.PurchasePrice = double.Parse(reader[ConfigManager.PurchasePriceDb].ToString()); purchaseDataRecieve.NumberOfPayments = reader[ConfigManager.NumberOfPaymentsDb].ToString(); purchaseDataRecieve.PricePerPayment = double.Parse(reader[ConfigManager.PricePerPaymentDb].ToString()); purchaseDataRecieve.IsValid = reader[ConfigManager.IsValidDb].ToString(); purchaseDataRecieve.WhyInvalid = reader[ConfigManager.WhyInvalidDb].ToString(); purchasesDataRecieve.Add(purchaseDataRecieve); } reader.Close(); CloseConnection(); return(purchasesDataRecieve); }
public void RecordWithDateWhenStoreClose() { PurchaseData purchaseDataToSend = new PurchaseData(); purchaseDataToSend.CreateRecordWithDateWhenClose(); RabbitMQManager.Send(purchaseDataToSend); PurchaseDataRecieve relevantPurchase = DalAccess.PullLastPurchasesData(purchaseDataToSend.StoreId); relevantPurchase.Should().ExistsCorrectlyInDbWithDateWhenClose(purchaseDataToSend); }
public void InvalidCreditCasrNumber() { PurchaseData purchaseDataToSend = new PurchaseData(); purchaseDataToSend.CreateInvalidCredirCardRecord(); RabbitMQManager.Send(purchaseDataToSend); PurchaseDataRecieve relevantPurchase = DalAccess.PullLastPurchasesData(purchaseDataToSend.StoreId); relevantPurchase.Should().ExistsCorrectlyInDbWithCredirCardInvalid(purchaseDataToSend); }
public PurchaseDataRecieve PullLastPurchasesData(string storeId) { List <PurchaseDataRecieve> purchasesDataRecieve = PullAllPurchasesData(); PurchaseDataRecieve relevantPurchase = new PurchaseDataRecieve(); foreach (var purchase in purchasesDataRecieve) { if (purchase.StoreId.Equals(storeId)) { relevantPurchase = purchase; } } return(relevantPurchase); }
public RecordAssertions(PurchaseDataRecieve purchase) : base(purchase) { }
public static RecordAssertions Should(this PurchaseDataRecieve instance) => new RecordAssertions(instance);