public static void Main(string[] args) { var r = 0.0; Console.WriteLine("Please input a radius of the figure:"); try { r = double.Parse(Console.ReadLine()); if (r < 0) { throw new ArgumentException(); } } catch (Exception) { Console.WriteLine("Please input correct number in such format: x.zyl, which > 0"); Environment.Exit(1); } Delegator delegator = _calculationService.CalculateLengthOfCircle; Console.WriteLine($"CalculateLengthOfCircle executed. Res = {delegator(r)}"); delegator = _calculationService.CalculateVOfSphere; Console.WriteLine($"CalculateVOfSphere executed. Res = {delegator(r)}"); delegator = _calculationService.CalculateSquareOfCircle; Console.WriteLine($"CalculateSquareOfCircle executed. Res = {delegator(r)}"); }
static void Main() { var delegator = new Delegator(); foreach (var @delegate in new object[] { null, new Inoperable(), new Operable() }) { delegator.Delegate = @delegate; Console.WriteLine(delegator.Operate()); } }
public void Init(TextAsset asset, Delegator del) { this.m_States = new List <State>(); this.m_StateGroups = new List <StateGroup>(); this.m_Transitions = new List <StateTransition>(); this.m_Del = del; this.Load(asset); this.SetupStates(); }
public void Dispose() { try { Delegator.Dispose(); } catch (DllNotFoundException) { // This eliminates an invalid call to a DLL that isn't present. GC.SuppressFinalize(Delegator); } }
/// <summary> /// Runs test cases /// </summary> public static void TestSuite() { string username = "******"; WebappSandboxLogin(webappDriver, username, GetUserPassword(username)); Delegator delegatedFunction = WebappSandboxSalesOrder; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); }
static void Main(string[] args) { var delegator = new Delegator(); delegator.ToA(); delegator.F(); delegator.ToB(); delegator.F(); }
/// <summary> /// 转发消息。 /// </summary> /// <param name="message">消息。</param> /// <returns>成功返回true;否则返回false。</returns> internal Boolean OnReceive(Message message) { try { Delegator delegator = GetDelegator(message.Destination); if (delegator == null) { return(false); } Byte[] data = _formatter.Serialize(message); delegator.OnReceive(data); return(true); } catch (Exception) { return(false); } }
/// <summary> /// Wraps tests with a try-catch-except logic that creates logs /// </summary> /// <param name="delegatedFunction"></param> /// <param name="remoteWebDriver"></param> public static void BasicTestWrapper(Delegator delegatedFunction, RemoteWebDriver webappDriver, RemoteWebDriver backofficeDriver) { string functionName = delegatedFunction.Method.Name.ToString(); Exception error = null; bool testSuccess = true; try { delegatedFunction(webappDriver, backofficeDriver); } catch (Exception e) { error = e; testSuccess = false; } finally { WriteToSuccessLog(functionName, testSuccess, error); } }
static void Main(string[] args) { Delegator del = new Delegator(TestDelegate.MethodDelegator); TestDelegate tsc = new TestDelegate(); Console.WriteLine("1 get , 2 set"); int x = Convert.ToInt32(Console.ReadLine()); string temp = del(x); tsc.MyEventHandler += TestDelegate.MethodDelegator; Console.WriteLine("Исп делегата " + temp); Console.WriteLine(tsc.EventOn(x)); var yardracers = new YardRacers { NameRacer = "Быстров Валерий Витольдович", Birthday = DateTime.Today, Cars = new List <Cars>() }; yardracers.Cars.Add(new Cars { CarName = "Чепырка", CarAge = 228 }); var racersrep = new RacersRepository(); racersrep.AddRacer(yardracers); Console.WriteLine("\n\tГонщик: " + yardracers.NameRacer); Console.WriteLine("\tДень рождения гонщика: " + yardracers.Birthday); foreach (var i in yardracers.Cars) { Console.WriteLine("\tМодель авто ({0}), лет {1} . ", i.CarName, i.CarAge); } Console.ReadKey(); //ClassTestInterface cti = new ClassTestInterface(); //Console.WriteLine(cti.Testinterface(x)); }
/// <summary> /// 在消息服务中注册一位代表。 /// </summary> /// <param name="delegator">代表。</param> /// <returns>成功返回true;否则返回false。</returns> public Boolean Register(Delegator delegator) { String id = delegator.ID; if (String.IsNullOrWhiteSpace(id)) { return(false); } if (_regedit.ContainsKey(id)) { try { return(_regedit[id] == delegator); }//对象已失效 catch (RemotingException) { _regedit.Remove(id); _regedit.Add(id, delegator); return(true); } } _regedit.Add(id, delegator); return(true); }
private void _GenerateIndexBitRelation(ref uint[,] indexBitRelations, ref bool[] isGenerated, int index, int startIndex, int endIndex) { int intCount = (Count >> 5) + 1; // need column fields Object row = Rows[index]; // each row has its own bit high int intOffset = index >> 5; indexBitRelations[index, intOffset] |= (uint)1 << index; // check isAX columns for (int j = startIndex; j < endIndex; j++) { int value = (int)Delegator.GetPublicFieldDelegate(j).GetValue(row); if (value == -1) { continue; // at first -1, no other values have been found (tested) } intOffset = value >> 5; indexBitRelations[index, intOffset] |= (uint)1 << value; if (!isGenerated[value]) { _GenerateIndexBitRelation(ref indexBitRelations, ref isGenerated, value, startIndex, endIndex); isGenerated[value] = true; } // now we need to | the related row and its relations for (int relationIndex = 0; relationIndex < intCount; relationIndex++) { indexBitRelations[index, relationIndex] |= indexBitRelations[value, relationIndex]; } } }
public void Log(string message) => Delegator.Log(Prefix + message);
public StateTransition(Delegator del) { this.m_Del = del; }
/// <summary> /// Runs test cases /// </summary> public static void TestSuite(string chosenUsername, Dictionary <string, bool> testsToRun) { Username = chosenUsername; Password = GetUserPassword(Username); if (testsToRun["New Account ?"]) { BackofficeNavigation.GeneralActions.SandboxCreateLog(backofficeDriver2); backofficeDriver2.Quit(); } // Login Webapp_Sandbox_Login(webappDriver, Username, Password); BackofficeNavigation.GeneralActions.SandboxLogin(backofficeDriver, Username, Password, true); if (testsToRun["New Account ?"]) { // Load file items / inventory / accounts Delegator delegatedFunction = backoffice_Custom_Fields_Acccounts; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = backoffice_Custom_Fields_Transaction; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = backoffice_Custom_Fields_Activities; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Backoffice_Sandbox_Load_File; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Backoffice_Sandbox_Create_Lists_Accounts; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Backoffice_Sandbox_Smart_Search_List_Accounts; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Backoffice_Sandbox_Search_List_Accounts; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Sandbox_Create_Lists_Activities; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); //Customize Search Activities list delegatedFunction = Customize_Sandbox_Search_Activities; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); // Ceate Account Types delegatedFunction = Sandbox_Ceate_Account_Types; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Sandbox_Create_Sync; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Transaction_Accounts_Settings_BO_Customization; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Resync"]) { dynamic result = connectDB("select Name, IsMandatory, ERPReadOnly, ColumnType, DBColumnType from Wrnty.[ApiName] where ObjectTypeID = 105"); Delegator delegatedFunction = webapp_Sandbox_Resync; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); delegatedFunction = Sandbox_Ceate_Account_Types; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Config Home Button"]) { Delegator delegatedFunction = Webapp_Sandbox_Config_Home_Button; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Config App Buttons"]) { Delegator delegatedFunction = Webapp_Sandbox_Config_App_Buttons; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Sales Order"]) { Delegator delegatedFunction = Webapp_Sandbox_Sales_Order; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Item Search"]) { Delegator delegatedFunction = Webapp_Sandbox_Item_Search; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Minimum Quantity"]) { Delegator delegatedFunction = Webapp_Sandbox_Minimum_Quantity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Delete Cart Item"]) { Delegator delegatedFunction = Webapp_Sandbox_Delete_Cart_Item; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Unit Price Discount"]) { Delegator delegatedFunction = Webapp_Sandbox_Unit_Price_Discount; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Continue Ordering"]) { Delegator delegatedFunction = Webapp_Sandbox_Continue_Ordering; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Duplicate Line Item"]) { Delegator delegatedFunction = Webapp_Sandbox_Duplicate_Line_Item; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Inventory Alert"]) { Delegator delegatedFunction = Webapp_Sandbox_Inventory_Alert; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Search Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Search_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Delete Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Delete_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Search Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Search_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Drill Down"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Drill_Down; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Enter To Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Enter_To_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Activity Drilldown"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Activity_Drilldown; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Breadcrumbs Navigation"]) { Delegator delegatedFunction = Webapp_Sandbox_Breadcrumbs_Navigation; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Duplicate Transaction"]) { Delegator delegatedFunction = Webapp_Sandbox_Duplicate_Transaction; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Order By Accounts"]) { Delegator delegatedFunction = Sandbox_Order_By_Accounts; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Image Home"]) { Delegator delegatedFunction = Sandbox_Minimize_Home_As_Tablet; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Creat Bayer"]) { Delegator delegatedFunction = Backoffice_Sandbox_Creat_Byer; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Transaction Accounts Settings"]) { Delegator delegatedFunction = Transaction_Accounts_Settings; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } #region Home page test //1 if (testsToRun["Change title home screen"]) { Delegator delegatedFunction = Webapp_Sandbox_Change_Title_Home_Screen; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //2 if (testsToRun["Change Title All Home"]) { Delegator delegatedFunction = Webapp_Sandbox_Change_All_Home; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //3 if (testsToRun["Menu of Home screen"]) { Delegator delegatedFunction = Webapp_Sandbox_Menu_Home_Screen; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //4 if (testsToRun["Online action"]) { Delegator delegatedFunction = Webapp_Sandbox_Online_action_Home_Page; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //5 if (testsToRun["Branding color Main"]) { Delegator delegatedFunction = Sandbox_Branding_Color_Main; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //6 if (testsToRun["Branding color Secondary"]) { Delegator delegatedFunction = Sandbox_Branding_Color_Secondary; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } //7 if (testsToRun["Branding image logo"]) { Delegator delegatedFunction = Sandbox_Branding_Logo; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } #endregion #region new Accounts_list if (testsToRun["Basic_List_Account_Table"]) { Delegator delegatedFunction = Sandbox_Add_Basic_List; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["TSA_List_Account_Table"]) { Delegator delegatedFunction = Sandbox_TSA_Fields_Header; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Search Account"]) { Delegator delegatedFunction = Sandbox_Search_Account; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Smart_Search_Account"]) { Delegator delegatedFunction = Sandbox_Smart_Search; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["TSA_Smart_Search_Account"]) { Delegator delegatedFunction = Sandbox_TSA_Smart_Search; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Create Account"]) { Delegator delegatedFunction = Sandbox_add_Account; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } #endregion #region if (testsToRun["Order By Activities"]) { Delegator delegatedFunction = Sandbox_Order_By_Activities; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } #endregion }
/// <summary> /// Runs test cases /// </summary> public static void TestSuite(string chosenUsername, Dictionary <string, bool> testsToRun) { DanUsername = chosenUsername; DanPassword = GetUserPassword(DanUsername); Webapp_Sandbox_Login(webappDriver, DanUsername, DanPassword); Backoffice.GeneralActions.SandboxLogin(backofficeDriver, DanUsername, DanPassword); if (testsToRun["Resync"]) { Delegator delegatedFunction = Webapp_Sandbox_Resync; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Config Home Button"]) { Delegator delegatedFunction = Webapp_Sandbox_Config_Home_Button; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Config App Buttons"]) { Delegator delegatedFunction = Webapp_Sandbox_Config_App_Buttons; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Sales Order"]) { Delegator delegatedFunction = Webapp_Sandbox_Sales_Order; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Item Search"]) { Delegator delegatedFunction = Webapp_Sandbox_Item_Search; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Minimum Quantity"]) { Delegator delegatedFunction = Webapp_Sandbox_Minimum_Quantity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Delete Cart Item"]) { Delegator delegatedFunction = Webapp_Sandbox_Delete_Cart_Item; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Unit Price Discount"]) { Delegator delegatedFunction = Webapp_Sandbox_Unit_Price_Discount; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Continue Ordering"]) { Delegator delegatedFunction = Webapp_Sandbox_Continue_Ordering; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Duplicate Line Item"]) { Delegator delegatedFunction = Webapp_Sandbox_Duplicate_Line_Item; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Inventory Alert"]) { Delegator delegatedFunction = Webapp_Sandbox_Inventory_Alert; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Search Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Search_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Delete Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Delete_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Search Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Search_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Drill Down"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Drill_Down; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Enter To Activity"]) { Delegator delegatedFunction = Webapp_Sandbox_Enter_To_Activity; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Account Activity Drilldown"]) { Delegator delegatedFunction = Webapp_Sandbox_Account_Activity_Drilldown; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Breadcrumbs Navigation"]) { Delegator delegatedFunction = Webapp_Sandbox_Breadcrumbs_Navigation; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Duplicate Transaction"]) { Delegator delegatedFunction = Webapp_Sandbox_Duplicate_Transaction; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["Search Account"]) { Delegator delegatedFunction = Webapp_Sandbox_Search_Account; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } if (testsToRun["item search 2"]) { Delegator delegatedFunction = Webapp_Sandbox_Item_Search2; BasicTestWrapper(delegatedFunction, webappDriver, backofficeDriver); } }
internal byte[] Wrap(byte[] data) => Delegator.Wrap(data);
public Form2() { InitializeComponent(); delegator += SortCollection; }
internal byte[] Wrap(ReadOnlySpan <byte> data) => Delegator.Wrap(data);
public void Assert(bool condition, string message) => Delegator.Assert(condition, Prefix + message);
public State(Delegator del) { this.m_Del = del; }
public static int Test(int a, int b, Delegator del) { return(del(a, b)); }