public Result TriggerAction(object id, string action, string triggeredBy) { var actionEvents = new ActionEvents(); using (var unitOfWork = UnitOfWorkFactory.Create()) { var entity = unitOfWork.ReadOnlyRepository <TContext, TEntity>().GetById(id); if (entity is IEntityAggregateRoot) { IDomainActionEvent actionEvent = actionEvents.CreateEntityActionEvent(action, null, entity, triggeredBy); if (actionEvent != null) { ((IEntityAggregateRoot)entity).AddActionEvent(actionEvent); var validationResult = unitOfWork.Repository <TContext, TEntity>().Update(entity, triggeredBy); if (validationResult.IsFailure) { return(Result.ObjectValidationFail <TEntity>(validationResult.ObjectValidationErrors)); } return(unitOfWork.Complete()); } } } return(Result.Ok()); }
public async Task <Result> TriggerActionAsync(object id, string action, string triggeredBy, CancellationToken cancellationToken) { var actionEvents = new ActionEvents(); using (var unitOfWork = UnitOfWorkFactory.Create()) { var entity = await unitOfWork.ReadOnlyRepository <TContext, TEntity>().GetByIdAsync(cancellationToken, id); if (entity is IEntityAggregateRoot) { IDomainActionEvent actionEvent = actionEvents.CreateEntityActionEvent(action, null, entity, triggeredBy); if (actionEvent != null) { ((IEntityAggregateRoot)entity).AddActionEvent(actionEvent); var validationResult = unitOfWork.Repository <TContext, TEntity>().Update(entity, triggeredBy); if (validationResult.IsFailure) { return(Result.ObjectValidationFail <TEntity>(validationResult.ObjectValidationErrors)); } return(await unitOfWork.CompleteAsync(cancellationToken).ConfigureAwait(false)); } } } return(Result.Ok()); }
public void ValidateTotalAmount() { float totalPrice; ActionEvents.NavigateToWinPage(); Thread.Sleep(10000); ActionEvents.SelectSearchButton(); Thread.Sleep(10000); ActionEvents.EnterSearchText("Visual Studio"); Thread.Sleep(10000); ActionEvents.PressEnter(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); ActionEvents.SelectFirstPriceitem(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); Thread.Sleep(10000); //ActionEvents.MoveToAddToCartButton(); ((IJavaScriptExecutor)driver).ExecuteScript("window.scrollBy(0,250)", ""); ActionEvents.SelectAddToCartButton(); ActionEvents.SelectQtyOfItems("20"); Thread.Sleep(10000); CartPage cart = new CartPage(); totalPrice = ActionEvents.CalculateTotal(); string cad1 = cart.totalPrice.Text.Substring(1, cart.totalPrice.Text.Length - 1); float displayedTotal = float.Parse(cad1); //bool samePricesFlag = ActionEvents.ComparePricesOnCartPage(); Assert.IsTrue(totalPrice == displayedTotal); Console.WriteLine("The total price is correct: " + totalPrice); }
public void ValidateBothPricesOnDetailsPage() { string price1; string price2; ActionEvents.NavigateToWinPage(); Thread.Sleep(10000); ActionEvents.SelectSearchButton(); Thread.Sleep(10000); ActionEvents.EnterSearchText("Visual Studio"); Thread.Sleep(10000); ActionEvents.PressEnter(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); SearchResultsPage resultsPage = new SearchResultsPage(); price1 = resultsPage.firstPriceItem.Text; ActionEvents.SelectFirstPriceitem(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); ProductDetailsPage detailsPage = new ProductDetailsPage(); price2 = detailsPage.price.Text; Assert.IsTrue(price1.Equals(price2)); Console.WriteLine("Both Prices are the same"); //ActionEvents.PrintVSPrices(); //ActionEvents.storeFirstResultItem(); }
public void ValidateWindows10ItemsPrinting() { ActionEvents.SelectWindowsMenu(); ActionEvents.SelectWindows10(); ActionEvents.PrintWin10Items(); //WindowsPage winPage = new WindowsPage(); //Assert.IsTrue(winPage.obtainWin10.Displayed); //Console.WriteLine("The next menu item is correctly displayed: "); }
public void ExecuteAction(ActionEvents <TouchState, IGestureInfo[]> actions) { foreach (var pair in actionTask) { pair.Value.Sort(compareByTouchInfo); actions.Execute(pair.Key, pair.Value.ToArray()); pair.Value.Clear(); } Clear(); }
public void ExecuteAction(ActionEvents<TouchState, IGestureInfo[]> actions) { foreach (var pair in actionTask) { pair.Value.Sort(compareByTouchInfo); actions.Execute(pair.Key, pair.Value.ToArray()); pair.Value.Clear(); } Clear(); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
protected override void Initialize() { actions = new ActionEvents <TouchState, IGestureInfo[]>(); taskList = new TouchTaskList(); infoList = new TouchInfoList(taskList); Input.simulateMouseWithTouches = false; #if UNITY_STANDALONE || UNITY_EDITOR StartCoroutine(mouseEmulate()); #endif }
public void ValidatePrivaliaBR() { //initDriver("https://www.privalia.com"); //FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"D:\instaladores\geckoDriver", "geckodriver.exe"); //IWebDriver driver2 = new FirefoxDriver(service); //driver.Navigate().GoToUrl("https://br.privalia.com/"); ActionEvents.NavigateTo("https://br.privalia.com"); PrivaliaBRHomePage homee = new PrivaliaBRHomePage(); ActionEvents.ClickOnItem(homee.entrarLink); Assert.IsTrue(true); //closeDriver(); }
public void ValidateSearchOnWinPage() { ActionEvents.NavigateToWinPage(); Thread.Sleep(10000); ActionEvents.SelectSearchButton(); Thread.Sleep(10000); ActionEvents.EnterSearchText("Visual Studio"); Thread.Sleep(10000); ActionEvents.PressEnter(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); SearchResultsPage resultsPage = new SearchResultsPage(); Assert.IsTrue(resultsPage.softwareTitle.Text.Contains("Software")); Console.WriteLine("Visual Studio search was successfully performed"); ActionEvents.PrintVSPrices(); ActionEvents.storeFirstResultItem(); }
protected override void OnConfigureStrategy(IConfigurableBindingStrategy strategy) { ActionEvents events = OnGetExpectedEvents(); if ((events & ActionEvents.Element) > 0) { strategy.OnElement(OnElement); } if ((events & ActionEvents.Completed) > 0) { strategy.OnCompleted(OnCompleted); } if ((events & ActionEvents.Error) > 0) { strategy.OnError(OnError); } if ((events & ActionEvents.Finally) > 0) { strategy.OnFinally(OnFinally); } }
public void ValidateAddToCartFunctionality() { ActionEvents.NavigateToWinPage(); Thread.Sleep(10000); ActionEvents.SelectSearchButton(); Thread.Sleep(10000); ActionEvents.EnterSearchText("Visual Studio"); Thread.Sleep(10000); ActionEvents.PressEnter(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); ActionEvents.SelectFirstPriceitem(); Thread.Sleep(10000); ActionEvents.CloseMarketModal(); Thread.Sleep(10000); //ActionEvents.MoveToAddToCartButton(); ((IJavaScriptExecutor)driver).ExecuteScript("window.scrollBy(0,250)", ""); ActionEvents.SelectAddToCartButton(); bool samePricesFlag = ActionEvents.ComparePricesOnCartPage(); Assert.IsTrue(samePricesFlag); Console.WriteLine("The 3 dispalyed prices are the same"); }
public MvcControllerEntityAuthorizeBase(Boolean admin, IEntityService service, IMapper mapper = null, IEmailService emailService = null, AppSettings appSettings = null) : base(admin, service, mapper, emailService, appSettings) { actionEvents = new ActionEvents(); }
public ApiControllerEntityAuthorizeBase(string resource, IEntityService service, IMapper mapper, IEmailService emailService, IUrlHelper urlHelper, ITypeHelperService typeHelperService, AppSettings appSetings, IAuthorizationService authorizationService) : base(resource, service, mapper, emailService, urlHelper, typeHelperService, appSetings, authorizationService) { actionEvents = new ActionEvents(); }