public void GivenIHaveAProductOnTheHubWithACurrentStockLevel() { TI.trace(section, "#1"); TI.trace(section,"Choose product SP005"); ScenarioTestHelper th = ObjectFactory.GetInstance<ScenarioTestHelper>(); Config c = th.GetConfig(); Product testProduct = th.ProductByProductCode( productCode); User localUser = th.LocalUser(); var settings = new ScenarioSettings { Product = testProduct, HubConfig = c, LocalUser = localUser }; settings.OriginalInventoryLevel = th.InventoryLevel(settings); ScenarioContext.Current["settings"] = settings; }
public ScenarioSelectionItem(EnterpriseScenario scenario) { ScenarioId = scenario.EnterpriseScenarioId; Name = scenario.Name; EstimatedRunTime = scenario.EstimatedRuntime; // ScenarioSettings override the default if (!string.IsNullOrEmpty(scenario.ScenarioSettings)) { ScenarioSettings settings = LegacySerializer.DeserializeDataContract <ScenarioSettings>(scenario.ScenarioSettings); EstimatedRunTime = settings.EstimatedRunTime; } }
public void GivenIHaveAProductStockOnTheHubThatIWantToIssueToAsASalesmanServer() { TI.trace(section, "#1"); TI.trace(section, "Choose product SP005"); ScenarioTestHelperLocal th = ObjectFactory.GetInstance<ScenarioTestHelperLocal>(); Config c = th.GetConfig(); Product testProduct = th.ProductByProductCode(productCode); User localUser = th.LocalUser(); var salesman = th.Salesman("S001"); var settings = new ScenarioSettings { Product = testProduct, HubConfig = c, LocalUser = localUser, Salesman = salesman }; settings.HubOriginalQuantity = th.HubInventoryLevel(settings); TI.trace(section, "HubOriginalQuantity " + settings.HubOriginalQuantity); settings.SalesmanOriginalQuantity = th.SalesmanInventoryLevel(settings); TI.trace(section, "SalesmanOriginalQuantity " + settings.SalesmanOriginalQuantity); ScenarioContext.Current["settings"] = settings; }
public void GivenIGenerateAPaymentNote() { TI.trace(section,"#1"); var testHelper = ObjectFactory.GetInstance<ScenarioTestHelper>(); var config = testHelper.GetConfig(); var user = testHelper.User(); var distributor = testHelper.Distributor(); var salesman = testHelper.DistributorSalesman(); var settings = new ScenarioSettings() { Distributor = distributor, DistributorSalesman = salesman, User = user, HubConfig = config }; settings.OriginalAmount = testHelper.Amount(settings.DocumentId); ScenarioContext.Current["settings"] = settings; var note = testHelper.CreatePaymentNote(settings); ScenarioContext.Current["note"] = note; }
public void GivenICreateAReceiptNoteServer() { TI.trace(section, "#1"); var testHelper = ObjectFactory.GetInstance<ScenarioTestHelperLocal>(); var config = testHelper.GetConfig(); var user = testHelper.User(); var settings = new ScenarioSettings() { User = user, HubConfig = config, MMomeyPaymentType = "Mpesa", NotificationId = "1", LineItemSequenceNo = 1 }; settings.OriginalAmount = testHelper.Amount(settings.DocumentId); settings.PaymentMode = testHelper.GetPaymentMode(); ScenarioContext.Current["settings"] = settings; var note = testHelper.CreateReceiptNote(settings); settings.DocumentId = note.Id; ScenarioContext.Current["note"] = note; }
public void GivenICreateAPurchaseOrderServer() { TI.trace(section, "#1"); var testHelper = ObjectFactory.GetInstance<ScenarioTestHelperLocal>(); var config = testHelper.GetConfig(); var user = testHelper.User(); var settings = new ScenarioSettings() { User = user, HubConfig = config, LineItemVatValue = LineItemVatValue, }; settings.OriginalQuantity = testHelper.Quantity(settings.DocumentId); settings.OriginalValue = testHelper.Value(settings.DocumentId); var masterDataHelper = ObjectFactory.GetInstance<MasterDataHelper>(); var product = masterDataHelper.GetSaleProduct(); settings.ProductId = product.Id; ScenarioContext.Current["settings"] = settings; var note = testHelper.CreateMainOrder(settings); settings.DocumentId = note.Id; ScenarioContext.Current["note"] = note; }
public void GivenICreateAnInvoice() { TI.trace(section, "#1"); var testHelper = ObjectFactory.GetInstance<ScenarioTestHelper>(); var config = testHelper.GetConfig(); var user = testHelper.User(); var settings = new ScenarioSettings() { User = user, HubConfig = config, LineItemSequenceNo = LineItemSequenceNo, DiscountType = DiscountType, }; settings.OriginalQuantity = testHelper.Quantity(settings.DocumentId); settings.OriginalValue = testHelper.Value(settings.DocumentId); var masterDataHelper = ObjectFactory.GetInstance<MasterDataHelper>(); var product = masterDataHelper.GetSaleProduct(); settings.ProductId = product.Id; ScenarioContext.Current["settings"] = settings; var note = testHelper.CreateInvoice(settings); settings.DocumentId = note.Id; ScenarioContext.Current["note"] = note; }
public Invoice CreateInvoice(ScenarioSettings localSetting) { var cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); var config = localSetting.HubConfig; var invoice = _invoiceFactory.Create(cc, config.CostCentreApplicationId, cc, localSetting.User, "Invoice", Guid.Empty, localSetting.OrderId); return invoice; }
public InvoiceLineItem CreateLineItem(ScenarioSettings localSettings) { var lineItem = _invoiceFactory.CreateLineItem(localSettings.ProductId, localSettings.OriginalQuantity, localSettings.OriginalValue, "Line Item 1", localSettings.LineItemSequenceNo, localSettings.LineItemVatValue, localSettings.ProductDiscount, localSettings.DiscountType); return lineItem; }
/// <summary> /// Initializes this instance with the specified object. /// </summary> /// <param name="entity">The entity.</param> /// <exception cref="ControlTypeMismatchException"> /// Thrown when an object of incorrect type is passed to this instance. /// </exception> public override void Initialize(object entity) { _scenario = entity as EnterpriseScenario; if (_scenario == null) { throw new ControlTypeMismatchException(entity, typeof(EnterpriseScenario)); } _owner = _scenario.Owner; // Set data source for the grid view and resize the columns resource_GridView.DataSource = _scenario.VirtualResources; resource_GridView.BestFitColumns(); // Set data sources for combo boxes using (EnterpriseTestContext context = new EnterpriseTestContext()) { string scenarioTags = GlobalSettings.Items[Setting.ScenarioTags]; vertical_ComboBox.Items.AddRange(scenarioTags.Split(',')); category_ComboBox.DataSource = EnterpriseScenario.SelectDistinctCompany(context).ToList(); if (UserManager.CurrentUser.HasPrivilege(UserRole.Manager) || (!string.IsNullOrEmpty(_scenario.Owner) && _scenario.Owner.Equals(UserManager.CurrentUserName))) { owner_ComboBox.Items.Add("Unknown"); foreach (var name in context.Users.Select(x => x.UserName)) { owner_ComboBox.Items.Add(name); } owner_ComboBox.SelectedItem = _scenario.Owner; editorGroups_CheckedListBox.BackColor = Color.FromKnownColor(KnownColor.Window); } else { owner_ComboBox.Items.Add(_scenario.Owner); editorGroups_CheckedListBox.SelectionMode = SelectionMode.None; editorGroups_CheckedListBox.BackColor = Color.FromKnownColor(KnownColor.Control); } LoadGroups(context); foreach (var group in context.UserGroups) { _availableGroups.Add(group); } sessionCycle_ComboBox.DataSource = ResourceWindowsCategory.Select(context, ResourceWindowsCategoryType.SessionCycle.ToString()); sessionCycle_ComboBox.SelectedIndex = -1; if (!string.IsNullOrEmpty(_scenario.ScenarioSettings)) { _settings = LegacySerializer.DeserializeDataContract <ScenarioSettings>(_scenario.ScenarioSettings); sessionCycle_ComboBox.SelectedIndex = ResourceWindowsCategory.Select(context, ResourceWindowsCategoryType.SessionCycle.ToString()).Select(x => x.Name).ToList().IndexOf(_settings.TargetCycle); } List <string> metadatas = new List <string>(); foreach (VirtualResource vr in _scenario.VirtualResources.Where(n => n.Enabled)) { foreach (var vrms in vr.VirtualResourceMetadataSet.Where(n => n.Enabled)) { metadatas.Add(vrms.MetadataType); } } _associatedProducts = context.AssociatedProducts.Where(n => n.MetadataTypes.Any(m => metadatas.Contains(m.Name))).ToList(); var productIds = _associatedProducts.Select(x => x.AssociatedProductId); _productVersions = AssociatedProductVersion.SelectVersions(context, productIds, _scenario.EnterpriseScenarioId).ToList(); _scenarioProducts = from productInfo in _associatedProducts join versionInfo in _productVersions on productInfo.AssociatedProductId equals versionInfo.AssociatedProductId select new ScenarioProduct { ProductId = productInfo.AssociatedProductId, Version = versionInfo.Version, ScenarioId = _scenario.EnterpriseScenarioId, Name = productInfo.Name, Vendor = productInfo.Vendor, Active = versionInfo.Active }; var scenarioProducts = _scenarioProducts.ToList(); if (scenarioProducts.Count != 0) { scenarioProductBindingSource.Clear(); scenarioProductBindingSource.DataSource = scenarioProducts.Distinct(new ScenarioProductEqualityComparer()); scenarioProductBindingSource.ResetBindings(true); } } // Set up data bindings name_TextBox.DataBindings.Add("Text", _scenario, "Name"); description_TextBox.DataBindings.Add("Text", _scenario, "Description"); category_ComboBox.DataBindings.Add("Text", _scenario, "Company"); vertical_ComboBox.DataBindings.Add("Text", _scenario, "Vertical"); //owner_ComboBox.DataBindings.Add("Text", _scenario, "Owner"); CreateResourceDropDownMenu(); //_associateProductHandler.CopyToUI(_associateProductHandler.CopyFromScenario(_scenario), this.associatedProducts_DataGrid); List <TimeSpan> failTimes = new List <TimeSpan>(); Dictionary <string, int> failureItems = new Dictionary <string, int>(); failureItems.Add("1 Failure", 1); failureItems.Add("2 Failures", 2); failureItems.Add("5 Failures", 5); failureItems.Add("10 Failures", 10); failureItems.Add("15 Failures", 15); failureItems.Add("20 Failures", 20); failTimes.Add(TimeSpan.FromMinutes(15)); failTimes.Add(TimeSpan.FromMinutes(30)); failTimes.Add(TimeSpan.FromHours(1)); failTimes.Add(TimeSpan.FromHours(2)); failTimes.Add(TimeSpan.FromHours(6)); failTimes.Add(TimeSpan.FromHours(12)); failureTime_comboBox.DataSource = new BindingSource(failTimes, null); threshold_comboBox.DataSource = new BindingSource(failureItems, null); threshold_comboBox.DisplayMember = "Key"; threshold_comboBox.ValueMember = "Value"; //if a new scenario, get empty, otherwise gather saved info from enterprise test. if (!string.IsNullOrEmpty(_scenario.ScenarioSettings)) { _settings = LegacySerializer.DeserializeDataContract <ScenarioSettings>(_scenario.ScenarioSettings); //Populate boxes from selected settings dartLog_CheckBox.Checked = _settings.NotificationSettings.CollectDartLogs; email_textBox.Text = _settings.NotificationSettings.Emails; failureTime_comboBox.SelectedIndex = failTimes.FindIndex(x => x == _settings.NotificationSettings.FailureTime); threshold_comboBox.SelectedIndex = failureItems.ToList().FindIndex(x => x.Value == _settings.NotificationSettings.FailureCount); triggerList_TextBox.Lines = _settings.NotificationSettings.TriggerList; //runtime_NumericUpDown.Value = _settings.EstimatedRunTime; runtime_NumericUpDown.Value = Math.Min(_settings.EstimatedRunTime, runtime_NumericUpDown.Maximum); logLocation_TextBox.Text = _settings.LogLocation; eventLog_CheckBox.Checked = _settings.CollectEventLogs; _scenarioCustomDictionary = _settings.ScenarioCustomDictionary; if (_scenarioCustomDictionary != null && _scenarioCustomDictionary.Count != 0) { customDictionary_listBox.DataSource = new BindingSource(_scenarioCustomDictionary, null); customDictionary_listBox.DisplayMember = "Key"; customDictionary_listBox.ValueMember = "Value"; } } else { //Populate combo boxes try { dartLog_CheckBox.Checked = _settings.NotificationSettings.CollectDartLogs; } catch { dartLog_CheckBox.Checked = false; } email_textBox.Text = ""; //Log settings logLocation_TextBox.Text = ""; eventLog_CheckBox.Checked = false; runtime_NumericUpDown.Value = Math.Min(_scenario.EstimatedRuntime, runtime_NumericUpDown.Maximum); } if (string.IsNullOrEmpty(logLocation_TextBox.Text)) { logLocation_TextBox.Text = GlobalSettings.WcfHosts[WcfService.DataLog]; } AddEventHandlers(); }
public InventoryAdjustmentNote CreateIAN(ScenarioSettings localSetting) { CostCentre cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); Config c = localSetting.HubConfig; var note = _inventoryAdjustmentNoteFactory.Create(cc, c.CostCentreApplicationId, cc, localSetting.LocalUser, Guid.NewGuid().ToString().Substring(1, 10), InventoryAdjustmentNoteType.Available, Guid.Empty); return note; }
public decimal HubInventoryLevel(ScenarioSettings settings) { Inventory inv = _inventoryRepository.GetByProductIdAndWarehouseId(settings.Product.Id, settings.HubConfig.CostCentreId); return inv == null ? 0 : inv.Balance; }
public decimal SalesmanInventoryLevel(ScenarioSettings settings) { Inventory inv = _inventoryRepository.GetByProductIdAndWarehouseId(settings.Product.Id, settings.Salesman.Id); return inv == null ? 0 : inv.Balance; }
public MainOrder CreateMainOrder(ScenarioSettings localSetting) { var cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); var config = localSetting.HubConfig; var pn = _mainOrderFactory.Create(cc, config.CostCentreApplicationId, cc, localSetting.User, cc, localSetting.OrderType, localSetting.DocumentReference, localSetting.DocumentParentId, localSetting.ShipToAddress, localSetting.DateRequired, localSetting.SaleDiscount, "Main Order"); return pn; }
public async Task<bool> Sync(ScenarioSettings settings) { var r = await _sync.ReceiveAndProcessNextEnvelopesAsync(settings.HubConfig.CostCentreApplicationId); return r; }
public ReceiptLineItem CreateLineItem(ScenarioSettings localSettings) { var lineItem = _receiptFactory.CreateLineItem(localSettings.OriginalAmount, localSettings.PaymentId.ToString(), localSettings.MMomeyPaymentType, localSettings.NotificationId, localSettings.LineItemSequenceNo, localSettings.PaymentMode, "Receipt Note Line Item", localSettings.DocumentId, true); return lineItem; }
public decimal Amount(ScenarioSettings scenarioSettings) { var receiptNote = _receiptRepository.GetById(scenarioSettings.DocumentId); return receiptNote == null ? 10 : receiptNote.LineItems.FirstOrDefault().Value; }
public Receipt CreateReceiptNote(ScenarioSettings localSetting) { var cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); var config = localSetting.HubConfig; var receiptNote = _receiptFactory.Create(cc, config.CostCentreApplicationId, cc, localSetting.User, "Receipt Note", Guid.NewGuid(), localSetting.InvoiceId, localSetting.PaymentId); return receiptNote; }
public decimal Value(ScenarioSettings scenarioSettings) { var creditNote = _creditNoteRepository.GetById(scenarioSettings.DocumentId); return creditNote != null ? 10 : creditNote.LineItems.FirstOrDefault().Value; }
public DispatchNote CreateDn(ScenarioSettings localSetting) { CostCentre cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); Config c = localSetting.HubConfig; var note = _dispatchNoteFactory.Create(cc, c.CostCentreApplicationId, cc, localSetting.LocalUser, cc, DispatchNoteType.Delivery, Guid.NewGuid().ToString().Substring(1, 10), Guid.Empty, Guid.Empty); /* var note = _documentFactory.CreateDocument(Guid.NewGuid(), DocumentType.DispatchNote, cc, cc, localSetting.LocalUser, Guid.NewGuid().ToString());*/ return note; }
public UserFormSteps(IWebDriver driver, ScenarioSettings scenarioSettings) { _driver = driver; _scenarioSettings = scenarioSettings; }
/// <summary> /// Requests that the control finalize any edits that have been made by saving /// them from the UI controls to their backing objects. /// </summary> public override void FinalizeEdit() { // Modify focus so that any data bindings will update name_Label.Focus(); foreach (UserGroup item in editorGroups_CheckedListBox.CheckedItems.Cast <UserGroup>()) { if (!_scenario.UserGroups.Any(x => x.GroupName.Equals(item.GroupName))) { var group = Context.UserGroups.FirstOrDefault(x => x.GroupName.Equals(item.GroupName)); if (group != null) { _scenario.UserGroups.Add(group); } } } Collection <UserGroup> removeList = new Collection <UserGroup>(); foreach (UserGroup item in _scenario.UserGroups) { if (!editorGroups_CheckedListBox.CheckedItems.Cast <UserGroup>().Any(x => x.GroupName.Equals(item.GroupName))) { removeList.Add(item); } } foreach (var group in removeList) { _scenario.UserGroups.Remove(group); } if (string.IsNullOrEmpty(_scenario.ScenarioSettings)) { _settings = new ScenarioSettings(); } if (_modified) { //Grab data from combo boxes, create settings, serialize _settings.EstimatedRunTime = (int)runtime_NumericUpDown.Value; _settings.TargetCycle = sessionCycle_ComboBox.Text; _settings.NotificationSettings.CollectDartLogs = dartLog_CheckBox.Checked; _settings.NotificationSettings.Emails = email_textBox.Text; _settings.NotificationSettings.FailureCount = (int)threshold_comboBox.SelectedValue; _settings.NotificationSettings.TriggerList = triggerList_TextBox.Lines; _settings.NotificationSettings.FailureTime = (TimeSpan)failureTime_comboBox.SelectedValue; _settings.LogLocation = logLocation_TextBox.Text; _settings.CollectEventLogs = eventLog_CheckBox.Checked; _settings.ScenarioCustomDictionary = _scenarioCustomDictionary; _scenario.ScenarioSettings = LegacySerializer.SerializeDataContract(_settings).ToString(); } //_scenarioProducts = scenarioProductBindingSource.DataSource as IEnumerable<ScenarioProduct>; using (EnterpriseTestContext context = new EnterpriseTestContext()) { for (int i = 0; i < associatedProducts_DataGrid.Rows.Count; i++) { ScenarioProduct prod = associatedProducts_DataGrid.Rows[i].DataBoundItem as ScenarioProduct; prod.Update(context); } //foreach (var product in _scenarioProducts) //{ // product.Update(context); //} } //_associateProductHandler.SaveData(_scenario.EnterpriseScenarioId, this.associatedProducts_DataGrid); }
public SubOrderLineItem CreateMainOrderLineItem(ScenarioSettings localSettings) { var lineItem = _mainOrderFactory.CreateLineItem(localSettings.ProductId, localSettings.OriginalQuantity, localSettings.OriginalValue, "Line Item 1", localSettings.LineItemVatValue); return lineItem; }
public decimal Amount(ScenarioSettings scenarioSettings) { var paymentNote = _paymentNoteRepository.GetById(scenarioSettings.DocumentId); return paymentNote == null ? 10 : paymentNote.LineItems.FirstOrDefault().Amount; }
public PaymentNote CreatePaymentNote(ScenarioSettings localSetting) { var salesman = localSetting.DistributorSalesman; var user = localSetting.User; var distributor = localSetting.Distributor; var note = _documentFactory.CreateDocument(localSetting.DocumentId, DocumentType.PaymentNote, salesman, distributor, user, "Payment Note") as PaymentNote; note.PaymentNoteType = PaymentNoteType.Availabe; note.DocumentDateIssued = DateTime.Now; note.EndDate = DateTime.Now; note.StartDate = DateTime.Now; note.EnableAddCommands(); note.SendDateTime = DateTime.Now; return note; }
public LoginSteps(IWebDriver driver, ScenarioSettings scenarioSettings) { _driver = driver; _scenarioSettings = scenarioSettings; }
public InventoryTransferNote CreateITN(ScenarioSettings localSetting) { CostCentre cc = _costCentreRepository.GetById(localSetting.HubConfig.CostCentreId); Config c = localSetting.HubConfig; var note = _inventoryTransferNoteFactory.Create(cc, c.CostCentreApplicationId, localSetting.LocalUser, localSetting.Salesman, cc, Guid.NewGuid().ToString().Substring(1, 10)); return note; }
public decimal Value(ScenarioSettings scenarioSettings) { var invoice = _invoiceRepository.GetById(scenarioSettings.DocumentId); return invoice != null ? 10 : invoice.LineItems.FirstOrDefault().Value; }
public static ScenarioSettings Example_1() { var lla = new LLA() { LatitudeDeg = 54.0, LongitudeDeg = 12.0, Altitude = 0.0 }; var flightpathSettings1 = new FlightpathSettings() { FlightpathId = 1, FlightpathName = "Ownship_XXX", PlatformType = "aircraft", PlatformIcon = "c-130_hercules", InitialPositionNorth = 0.0, InitialPositionEast = 0.0, InitialPositionDown = -5000.0, InitialVelocityNorth = 0.0, InitialVelocityEast = 0.0, InitialVelocityDown = 0.0 }; var flightpathSettings2 = new FlightpathSettings() { FlightpathId = 2, FlightpathName = "Target_001", PlatformType = "landsite", PlatformIcon = "sa-15_launcher_des", InitialPositionNorth = 30000.0, InitialPositionEast = 20000.0, InitialPositionDown = 0.0, InitialVelocityNorth = 0.0, InitialVelocityEast = 0.0, InitialVelocityDown = 0.0 }; var flightpathSettings3 = new FlightpathSettings() { FlightpathId = 3, FlightpathName = "Target_002", PlatformType = "landsite", PlatformIcon = "sa-15_launcher_des", InitialPositionNorth = -30000.0, InitialPositionEast = 30000.0, InitialPositionDown = 0.0, InitialVelocityNorth = 0.0, InitialVelocityEast = 0.0, InitialVelocityDown = 0.0 }; var flightpathSettings = new List <FlightpathSettings>() { flightpathSettings1, flightpathSettings2, flightpathSettings3 }; var s = new ScenarioSettings() { LLAOrigin = lla, FlightpathSettings = flightpathSettings }; return(s); }
public SubOrderLineItem CreateFOCLineItem(ScenarioSettings localSettings) { var lineItem = _mainOrderFactory.CreateFOCLineItem(localSettings.ProductId, localSettings.OriginalQuantity, "Line Item 1", localSettings.DiscountType); return lineItem; }
public CreditNoteLineItem CreateCreditNoteLineItem(ScenarioSettings localSettings) { var lineItem = _creditNoteFactory.CreateLineItem(localSettings.ProductId, localSettings.OriginalQuantity, localSettings.OriginalValue, "Line Item 1", localSettings.LineItemSequenceNo, localSettings.LineItemVatValue, localSettings.ProductDiscount); return lineItem; }
public Scenario(ScenarioSettings scenarioSettings) { ScenarioSettings = scenarioSettings; }