static void Main(string[] args) { StringProcessor stringProcessor = null; stringProcessor += PrintString; stringProcessor += PrintObject; stringProcessor("Test"); }
public void GetWordsLower_should_get_all_words() { var sentence = @"There are three species of zebras: the plains zebra, the Grévy's zebra and the mountain zebra."; var d = StringProcessor.GetWordsLower(sentence); Assert.IsTrue(d.Count() == 16); }
public void TargetIsSetForInstanceMetodsAndNullForStaticMethods() { StringProcessor instanceAction = delegateActions.ToUpperCase; StringProcessor staticAction = DelegateActions.ToUpperCaseStatic; Assert.NotNull(instanceAction.Target); Assert.Null(staticAction.Target); }
static void Main(string[] args) { string input = "ABC"; StringProcessor sp = new StringProcessor(); sp.Permute(input, 0, input.Length - 1); Console.ReadKey(); }
public void TestSingleChange() { var res = StringProcessor.ProcessString("<u>aa</u>", getSingleRule()); string strRes = res.Value; Assert.AreEqual("aa", strRes); Assert.AreEqual(1, res.Positions[u].Count); }
public AccountService(BPFinanceContext context, IOptions <AppSettings> appSettingsAccessor, IOptions <AppParams> appParamsAccessor) { _context = context; var repository = new BPFinanceRepository(_context, appParamsAccessor.Value.EditUserId); _businessUnitIds = appParamsAccessor.Value.BusinessUnitIds; var basketBusinessUnitIdProvider = new BasketBusinessUnitIdProvider(_context); _paymentInTimeDiscountProvider = new PaymentInTimeDiscountProvider(appParamsAccessor.Value.BusinessUnitSettings); _clientAccountProcessor = new ClientAccountProcessor( _context, repository); _accountSettingsProcessor = new AccountSettingsProcessor( _context, repository); _orderProcessor = new OrderProcesor( _context, repository, appParamsAccessor.Value.BasketOrderDescription, appParamsAccessor.Value.ManagerId, basketBusinessUnitIdProvider); var rubricProcessor = new RubricProcessor( _context, repository); var graphicProcessor = new GraphicProcessor( _context, repository); _orderImProcessor = new OrderImProcessor( _context, repository); var stringProcessor = new StringProcessor( _context, repository); var moduleProcessor = new ModuleProcessor( _context, repository); var moduleMaketProcessor = new ModuleMaketProcessor( appSettingsAccessor.Value.OrderImFolderTemplate, appSettingsAccessor.Value.DatabaseName); _positionImProcessor = new PositionImProcessor( _context, repository, _orderImProcessor, stringProcessor, moduleProcessor, moduleMaketProcessor); _orderPositionProcessor = new OrderPositionProcessor( _context, repository, rubricProcessor, graphicProcessor, _positionImProcessor, appParamsAccessor.Value.BasketOrderDescription); }
static void Main(string[] args) { ConsoleHelper.WriteText($"Greetings!\nThis programm calculates average amount of symbols in sentence words."); var str = "Викентий хорошо отметил день рождения: покушал пиццу, посмотрел кино, пообщался со студентами в чате."; //Результат не округляется. StringProcessor.FindAverageInSentence(str); ConsoleHelper.PressAnyKey(); }
public void TestMethod_RemoveDuplicates() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(2); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "ABbAcCc"); }
public void GetLoggerDefault() { Config.AddTestSettingValues("Log", LoggingEnabled.YES.ToString(), "MagenicMaqs", true); Config.AddTestSettingValues("LogType", "Default", "MagenicMaqs", true); LoggingConfig.GetLogger(StringProcessor.SafeFormatter( "{0} - {1}", "Test", DateTime.UtcNow.ToString("yyyy-MM-dd-hh-mm-ss-ffff", CultureInfo.InvariantCulture))); }
public void AddProcessorSwellsTheProcessingChainBy1() { string pattern1 = "\r\n"; IProcessor sample1 = new StringProcessor(pattern1, 0); TestSubject.AddProcessor(sample1); Assert.True(1 == TestSubject.SequentialProcessor.Count); }
/// <summary> /// Build a character constant from a double qouted string. /// </summary> /// <remarks> /// The leading and trailing double qoutes will be removed. /// </remarks> /// <param name="text">The text constant.</param> /// <returns>Returns an <see cref="AST.Constant"/> with a <see cref="ConstantType.CharacterConstant"/>.</returns> public static Constant DoubleQuotedConstant(string text) { // Remove the leading and trailing double quotes (if there is any) string processedText = (text.StartsWith("\"") && text.EndsWith("\"")) ? text.Substring(1, text.Length - 2) : text; return(new Constant(StringProcessor.ProcessEscapes(processedText), ConstantType.CharacterConstant)); }
static void Main(string[] args) { ConsoleHelper.WriteText($"Greetings!\nThis programm doubles all matching symbols from two strings."); var str1 = "написать программу, которая"; var str2 = "описание"; StringProcessor.DoubleMatches(str1, str2); ConsoleHelper.PressAnyKey(); }
public void TestMethod_OpenForDebateShouldThisBeOnePoundSignOrFour() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(9); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "£"); }
public void Step1_ValidInputLength() { var stringCalculator = new StringProcessor(); Assert.AreEqual(20, stringCalculator.getSum(userInput[0])); Assert.AreEqual(5001, stringCalculator.getSum(userInput[1])); Assert.AreEqual(1, stringCalculator.getSum(userInput[2])); Assert.AreEqual(5, stringCalculator.getSum(userInput[3])); }
public void TestMethod_Remove4AndUnderscoreGivingEmptyString() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(5); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "null or empty"); }
private static void FirstExample() { StringProcessor sp1 = new StringProcessor(PrintString1); StringProcessor sp2 = new StringProcessor(PrintString2); var sp = (StringProcessor)Delegate.Combine(sp1, sp2); sp.Invoke("s"); }
public void TestMethod_MoreThan15Chars() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(1); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "This is a strin"); }
public void TestMethod_ReplaceDollarSign() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(3); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "Show me the £"); }
public void TestMethod_EmptyStringSupplied() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(0); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata[0], "null or empty"); }
public void TestMethod_EmptyCollectionPassedIn() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); List <string> idata = new List <string>(); var odata = stringProcessor.ReformatCollection(idata); Assert.AreEqual(odata.Count, 0); }
public static TranslationLine[] ExportTranslationLines(STSCFile script, STSCFileDatabase database, StringProcessor processor = null) { if (processor == null) { processor = new StringProcessor(); } var lines = new List <TranslationLine>(); // The ID or name of the title, usually who is speaking byte titleID = 0xFF; string titleName = null; // Loop through all the instructions foreach (var instruction in script.Instructions) { switch (instruction.Name) { case "Name": titleName = instruction.GetArgument <string>(0); if (titleName.Length == 0) { titleName = null; } break; case "MesTitle": titleID = instruction.GetArgument <byte>(0); break; case "Message": case "Mes": // Get name of the character from string name = titleName ?? (titleID == 0xFF ? "None" : database?.Characters.FirstOrDefault(t => t.ID == titleID)?.FriendlyName); // Add Entry to file lines.Add(new TranslationLine("Message", name ?? $"Unknown [{titleID}]", instruction.GetArgument <string>(2))); break; case "Choice": case "SetChoice": lines.Add(new TranslationLine("Choice", "", instruction.GetArgument <string>(1))); break; case "MapPlace": lines.Add(new TranslationLine("MapMarker", "", instruction.GetArgument <string>(1))); break; default: continue; } } lines.ForEach(t => { t.Comment = processor.Process(t.Comment); t.Key = processor.Process(t.Key); }); return(lines.ToArray()); }
public OrderPositionService(BPFinanceContext context, IOptions <AppSettings> appSettingsAccessor, IOptions <AppParams> appParamsAccessor) { _context = context; var repository = new BPFinanceRepository(_context, appParamsAccessor.Value.EditUserId); var orderImFolderTemplate = appSettingsAccessor.Value.OrderImFolderTemplate; var dbName = appSettingsAccessor.Value.DatabaseName; var basketBusinessUnitIdProvider = new BasketBusinessUnitIdProvider(_context); _orderPositionDataProcessor = new OrderPositionDataProcessor( _context, orderImFolderTemplate, dbName); _clientProcessor = new ClientProcessor( _context); _orderProcessor = new OrderProcesor( _context, repository, appParamsAccessor.Value.BasketOrderDescription, appParamsAccessor.Value.ManagerId, basketBusinessUnitIdProvider); var rubricProcessor = new RubricProcessor( _context, repository); var graphicProcessor = new GraphicProcessor( _context, repository); var orderImProcessor = new OrderImProcessor( _context, repository); var stringProcessor = new StringProcessor( _context, repository); var moduleProcessor = new ModuleProcessor( _context, repository); var moduleMaketProcessor = new ModuleMaketProcessor( appSettingsAccessor.Value.OrderImFolderTemplate, appSettingsAccessor.Value.DatabaseName); var positionImProcessor = new PositionImProcessor( _context, repository, orderImProcessor, stringProcessor, moduleProcessor, moduleMaketProcessor); _orderPositionProcessor = new OrderPositionProcessor( _context, repository, rubricProcessor, graphicProcessor, positionImProcessor, appParamsAccessor.Value.BasketOrderDescription); }
public static async Task SendBoundEmail(String to, String toName, String subject, String emailTemplateName, List <Object> emailInputData, String fromEmail = null) { List <FieldDataBindingModel> boundData = BoundDataManager.GetBoundDataList <EmailBoundAttribute>(emailInputData); var bodyTemplate = GetEmailTemplate(emailTemplateName); var body = StringProcessor.GetStringWithSubstitutions(bodyTemplate, boundData); await Send(to, toName, subject, body, fromEmail); }
public void TestMethod_SuppliedLDCString() { StringProcessor stringProcessor = new StringProcessor(new ReformatStrategyLDC()); var idata = MockData(6); var odata = stringProcessor.ReformatCollection(idata); // "AAAc91%cWwWkLq$1ci3_848v3d__K" Assert.AreEqual(odata[0], "Ac91%cWwWkLq£1c"); }
internal new void OnDeserialized(StreamingContext context) { _password = null; if (_serializationPassword != null) { StringProcessor.TryTransformDataBack(_serializationPassword, out _password); } _Initialize(); }
public static List <string> ProcessList(List <string> strings, StringProcessor processor) { List <string> newList = new List <string>(); foreach (string str in strings) { newList.Add(processor(str)); } return(newList); }
/// <summary> /// Raise an event message /// </summary> /// <param name="actionType">The type of action</param> /// <param name="query">The query string</param> private void RaiseEvent(string actionType, string query) { try { this.OnEvent(StringProcessor.SafeFormatter("Performing {0} with:\r\n{1}", actionType, query)); } catch (Exception e) { this.OnErrorEvent(StringProcessor.SafeFormatter("Failed to log event because: {0}", e.ToString())); } }
/// <summary> /// Wait for the element attributes to equal the correct text value /// </summary> /// <param name="by">'by' selector for the element</param> /// <param name="textValue">Text String expected to equal value of attribute</param> /// <param name="attribute">Attribute name as a String</param> /// <returns>Element if the attribute equals given string</returns> /// <example> /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="WaitForAttributeEquals" lang="C#" /> /// <code source = "../SeleniumUnitTesting/SeleniumWebElementTest.cs" region="WaitForAttributeEquals" lang="C#" /> /// </example> public IWebElement ForAttributeTextEquals(By by, string textValue, string attribute) { try { return(this.webDriverWait.Until(AttributeEqualsExpectedText(by, textValue, attribute, this.searchItem))); } catch { throw new NotFoundException(StringProcessor.SafeFormatter("The element attribute {0} inside '{1}' with the value of {2} was not found", attribute, by.ToString(), textValue)); } }
/// <summary> /// Function to get the Web Collection /// </summary> /// <param name="by">Css Selector</param> /// <param name="assert">optional assert parameter</param> /// <returns> Returns a Web Element Collection</returns> private ICollection <IWebElement> ElemList(By by, bool assert = true) { ICollection <IWebElement> elems = this.searchItem.FindElements(by); if (elems.Count > 0 || !assert) { return(elems); } throw new NotFoundException(StringProcessor.SafeFormatter("No result found for By {0}", by.ToString())); }
/// <summary> /// Logs the message to the logger /// </summary> /// <param name="expectedText">Expected value of the string </param> /// <param name="actualText">Actual value of the string</param> /// <param name="message">Test Name or Message</param> /// <param name="result">Decides the message type to be logged</param> private void LogMessage(string expectedText, string actualText, string message, bool result) { if (result) { this.Log.LogMessage(MessageType.SUCCESS, StringProcessor.SafeFormatter("Soft Assert '{0}' passed. Expected Value = '{1}', Actual Value = '{2}'.", message, expectedText, actualText)); } else { this.Log.LogMessage(MessageType.WARNING, StringProcessor.SafeFormatter("Soft Assert '{0}' failed. Expected Value = '{1}', Actual Value = '{2}'.", message, expectedText, actualText)); } }
static void Main(string[] args) { Person jon = new Person("Jon"); Person tom = new Person("Ton"); StringProcessor jonsVoice, tomsVoice, background; jonsVoice = new StringProcessor(jon.Say); jonsVoice += new StringProcessor(tom.Say); tomsVoice = new StringProcessor(tom.Say); background = new StringProcessor(Background.Note); jonsVoice("Hello,son."); tomsVoice.Invoke("Hello,Daddy!"); background("An airplan flies past."); Console.ReadLine(); }
static void Main() { Person jon = new Person("Jon"); Person tom = new Person("Tom"); StringProcessor jonsVoice, tomsVoice, background; jonsVoice = new StringProcessor(jon.Say); tomsVoice = new StringProcessor(tom.Say); background = new StringProcessor(Background.Note); jonsVoice("Hello, son."); tomsVoice.Invoke("Hello, Daddy!"); background("An airplane flies past."); }