public void SetUp() { _itemFactoryMock = A.Fake <IDocumentItemFactory>(); _propertiesFactoryMock = A.Fake <IPropertiesFactory>(); _paragraphUnitMock = A.Fake <IParagraphUnit>(); A.CallTo(() => _itemFactoryMock.CreateParagraphUnit(A <LockTypeFlags> .Ignored)).Returns(_paragraphUnitMock); }
private static IEndTagProperties CreateEndTagProperties(IPropertiesFactory propertyFactory) { var endTagProperties = propertyFactory.CreateEndTagProperties("</cf>"); endTagProperties.DisplayText = "cf"; endTagProperties.CanHide = true; return(endTagProperties); }
internal IEndTagProperties CreateEndTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var endProperties = factory.CreateEndTagProperties(tagContent); ApplyInlineTagProperties(endProperties, rule); endProperties.DisplayText = GetDisplayName(tagContent); return(endProperties); }
protected EventWebServicesTests(string baseUri) { if (string.IsNullOrWhiteSpace(baseUri)) throw new ArgumentNullException(nameof(baseUri)); if (!Uri.IsWellFormedUriString(baseUri, UriKind.RelativeOrAbsolute)) throw new FormatException("baseUri"); var rndGenerator = new RandomGenerator(); GuidKeyGenerator = new SequentialGuidKeyGenerator(); var fpiKeyGenerator = new FpiKeyGenerator( new ContentGenerator<ApprovalStatus>(() => Pick<ApprovalStatus>.RandomItemFrom(new[] { ApprovalStatus.Informal, ApprovalStatus.None })), new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[] { "RXJG", "GOGL", "MSFT", "YHOO" })), new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[] { "DTD", "XSL", "XML", "JSON" })), new ContentGenerator<string>(() => rndGenerator.Phrase(10)), new ContentGenerator<string>(() => Pick<string>.RandomItemFrom(new[] { "EN", "FR", "DE", "ES", "IT", "PL", "RO" }))); var valuesFactory = new ValuesFactory(GuidKeyGenerator); var parametersFactory = new ParametersFactory(valuesFactory); PropertiesFactory = new PropertiesFactory(GuidKeyGenerator, valuesFactory, parametersFactory); AlarmFactory = new AlarmFactory(GuidKeyGenerator, PropertiesFactory, valuesFactory); EventFactory = new EventFactory(GuidKeyGenerator, AlarmFactory, PropertiesFactory, valuesFactory); CalendarFactory = new CalendarFactory(GuidKeyGenerator, fpiKeyGenerator); ServiceClientFactory = new ServiceClientFactory(); ServiceClientFactory.Register(() => new JsonServiceClient(baseUri)); ServiceClientFactory.Register(() => new JsvServiceClient(baseUri)); ServiceClientFactory.Register(() => new XmlServiceClient(baseUri)); TestService = new EventTestService(); }
public IEmbeddedContentVisitor CreateVisitor(IDocumentItemFactory itemFactory, IPropertiesFactory propertiesFactory, ITextProcessor textProcessor) { _itemFactory = itemFactory; _propertiesFactory = propertiesFactory; _textProcessor = textProcessor; GeneratedParagraph = _itemFactory.CreateParagraphUnit(LockTypeFlags.Unlocked).Source; _currentContainer = GeneratedParagraph; return(this); }
public SegmentVisitor(IDocumentItemFactory documentItemDocumentItemFactory, IPropertiesFactory propertiesFactory, List <RegexPattern> patterns, string encryptionKey, bool arePatternsEcnrypted) { _documentItemFactory = documentItemDocumentItemFactory; _propertiesFactory = propertiesFactory; _arePatternsEcrypted = arePatternsEcnrypted; _patterns = patterns; _encryptionKey = encryptionKey; }
public AlarmFactory(IKeyGenerator<Guid> keyGenerator, IPropertiesFactory propertiesFactory, IValuesFactory valuesFactory) { if (keyGenerator == null) throw new ArgumentNullException(nameof(keyGenerator)); if (propertiesFactory == null) throw new ArgumentNullException(nameof(propertiesFactory)); this.keyGenerator = keyGenerator; this.rndGenerator = new RandomGenerator(); this.propertiesFactory = propertiesFactory; this.valuesFactory = valuesFactory; }
internal IStartTagProperties CreateStartTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var startProperties = factory.CreateStartTagProperties(tagContent); ApplyInlineTagProperties(startProperties, rule); startProperties.DisplayText = GetDisplayName(tagContent); startProperties.Formatting = FormattingInflator.InflateFormatting(rule.Formatting); startProperties.SegmentationHint = rule.SegmentationHint; return(startProperties); }
public void SetUp() { _yamlTextReaderMock = A.Fake <IYamlTextReader>(); _bilingualContentHandlerMock = A.Fake <IBilingualContentHandler>(); _embeddedContentRegexSettingsMock = A.Fake <IEmbeddedContentRegexSettings>(); _parsingSettingsMock = A.Fake <IParsingSettings>(); _paragraphUnitFactoryMock = A.Fake <IParagraphUnitFactory>(); _propertiesFactoryMock = A.Fake <IPropertiesFactory>(); _segmendDataCollectorMock = A.Fake <ISegmentDataCollector>(); _itemFactoryMock = A.Fake <IDocumentItemFactory>(); A.CallTo(() => _itemFactoryMock.PropertiesFactory).Returns(_propertiesFactoryMock); }
internal IPlaceholderTagProperties CreatePlaceholderTagProperties(IPropertiesFactory factory, string tagContent, IMatchRule rule) { var placeholderProps = factory.CreatePlaceholderTagProperties(tagContent); ApplyInlineTagProperties(placeholderProps, rule); placeholderProps.DisplayText = GetDisplayName(tagContent); placeholderProps.SegmentationHint = rule.SegmentationHint; placeholderProps.TagContent = tagContent; if (!string.IsNullOrEmpty(rule.TextEquivalent)) { placeholderProps.TextEquivalent = rule.TextEquivalent; } return(placeholderProps); }
public void SetUp() { _propertiesFactoryMock = A.Fake <IPropertiesFactory>(); _itemFactoryMock = A.Fake <IDocumentItemFactory>(); A.CallTo(() => _itemFactoryMock.PropertiesFactory).Returns(_propertiesFactoryMock); _bilingualContentHandlerMock = A.Fake <IBilingualContentHandler>(); _segmentSettingsMock = A.Fake <ISegmentSettings>(); _paragraphUnitFactoryMock = A.Fake <IParagraphUnitFactory>(); _lineParserMock = A.Fake <ILineParser>(); _entryBuilderMock = A.Fake <IEntryBuilder>(); _lineParsingSessionMock = A.Fake <ILineParsingSession>(); A.CallTo(() => _lineParserMock.StartLineParsingSession()).Returns(_lineParsingSessionMock); MathParseResultWithEntry(null, new ParseResult(LineType.Empty, string.Empty), null); MathParseResultWithEntry(@"entryComplete", new ParseResult(LineType.MessageString, "message string"), new Entry { MessageId = "message id", MessageString = "message string" }); MathParseResultWithEntry(@"emptyMsgidEntryComplete", new ParseResult(LineType.MessageId, string.Empty), new Entry { MessageId = string.Empty, MessageString = "message string" }); MathParseResultWithEntry(@"msgstrPluralEntryComplete", new ParseResult(LineType.MessageStringPlural, "message string 2"), new Entry { MessageId = "message id", MessageIdPlural = "message id plural", MessageStringPlurals = new List <string> { "message string 0", "message string 1", "message string 2" } }); }
public void SetUp() { _itemFactoryMock = A.Fake <IDocumentItemFactory>(); _propertiesFactoryMock = A.Fake <IPropertiesFactory>(); _textProcessorMock = A.Fake <ITextProcessor>(); _sourceParagraphMock = A.Fake <IParagraph>(); _textMock = A.Fake <IText>(); var paragraphUnitMock = A.Fake <IParagraphUnit>(); A.CallTo(() => _itemFactoryMock.CreateParagraphUnit(LockTypeFlags.Unlocked)).Returns(paragraphUnitMock); A.CallTo(() => paragraphUnitMock.Source).Returns(_sourceParagraphMock); var propertiesMock = A.Fake <ITextProperties>(); A.CallTo(() => propertiesMock.Text).Returns(TexBeforeProcessing); A.CallTo(() => _textMock.Properties).Returns(propertiesMock); }
private static IStartTagProperties CreateStartTagProperties(IPropertiesFactory propertyFactory, IFormattingItemFactory formattingFactory, IFormattingItem formattingItem, int tagId, string colorName) { var startTagProperties = propertyFactory.CreateStartTagProperties("<cf highlight=" + colorName + ">"); if (startTagProperties.Formatting == null) { startTagProperties.Formatting = formattingFactory.CreateFormatting(); } startTagProperties.Formatting.Add(formattingItem); startTagProperties.TagId = new TagId(tagId.ToString()); startTagProperties.CanHide = true; startTagProperties.DisplayText = "cf"; startTagProperties.SetMetaData(CadfBackgroundColorKey, "True"); foreach (var keyPair in GetBackgroundColorMetaData(colorName)) { startTagProperties.SetMetaData(keyPair.Key, keyPair.Value); } return(startTagProperties); }
public void ReplaceText(ISegment segment, IDocumentItemFactory factory, IPropertiesFactory propertiesFactory) { _factory = factory; _propertiesFactory = propertiesFactory; VisitChildren(segment); }
public SegmentBuilder() { _factory = DefaultDocumentItemFactory.CreateInstance(); _propertiesFactory = DefaultPropertiesFactory.CreateInstance(); _formattingFactory = _propertiesFactory.FormattingItemFactory; }
public static void UnlockContent(ISegment targetSegment, IDocumentItemFactory itemFactory, IPropertiesFactory propFactory) { Location textLocation = new Location(targetSegment, true); bool isLContentFound = false; do { ILockedContent content = textLocation.ItemAtLocation as ILockedContent; if (content != null) { isLContentFound = true; int indexInParent = content.IndexInParent; ILockedContent origLContent = (ILockedContent)content.Clone(); Location lockedLocation = new Location(origLContent.Content, true); Location origLocation = new Location(CloneContainer(content.Parent), true); // create new parent subitems IAbstractMarkupDataContainer newParent = content.Parent; newParent.Clear(); int index = 0; do // loop by parent location { // take from locked selection if (index == indexInParent) { do // loop by locked content { if (lockedLocation.ItemAtLocation != null) { newParent.Add((IAbstractMarkupData)lockedLocation.ItemAtLocation.Clone()); } }while (lockedLocation.MoveNextSibling()); index++; } // take original items else { if (origLocation.ItemAtLocation != null) { newParent.Add((IAbstractMarkupData)origLocation.ItemAtLocation.Clone()); } index++; } }while (origLocation.MoveNextSibling()); } }while (textLocation.MoveNext()); if (isLContentFound) { // merge IText objects MergeMarkupData(targetSegment, itemFactory, propFactory); } }
private static void MergeMarkupData(ISegment segment, IDocumentItemFactory itemFactory, IPropertiesFactory propFactory) { Location textLocation = new Location(segment, true); IText prevText = null; do { if (textLocation.ItemAtLocation != null) { IAbstractMarkupData currData = (IAbstractMarkupData)textLocation.ItemAtLocation.Clone(); IText currText = currData as IText; if (currText == null) { prevText = null; } else if (prevText == null) { prevText = currText; } else { prevText = itemFactory.CreateText(propFactory.CreateTextProperties(prevText.Properties.Text + currText.Properties.Text)); textLocation.ItemAtLocation.Parent.RemoveAt(textLocation.ItemAtLocation.IndexInParent); textLocation.MovePrevious(); textLocation.ItemAtLocation.Parent[textLocation.ItemAtLocation.IndexInParent] = prevText; } } }while (textLocation.MoveNextSibling()); }
public void SetUp() { _itemFactoryMock = A.Fake <IDocumentItemFactory>(); _propertiesFactoryMock = A.Fake <IPropertiesFactory>(); _paragraphUnitMock = A.Fake <IParagraphUnit>(); A.CallTo(() => _itemFactoryMock.CreateParagraphUnit(A <LockTypeFlags> .Ignored)).Returns(_paragraphUnitMock); _paragraphSourceMock = A.Fake <IParagraph>(); A.CallTo(() => _paragraphUnitMock.Source).Returns(_paragraphSourceMock); _paragraphTargetMock = A.Fake <IParagraph>(); A.CallTo(() => _paragraphUnitMock.Target).Returns(_paragraphTargetMock); _segmentPairPropertiesMock = A.Fake <ISegmentPairProperties>(); A.CallTo(() => _itemFactoryMock.CreateSegmentPairProperties()).Returns(_segmentPairPropertiesMock); _translationOriginMmock = A.Fake <ITranslationOrigin>(); A.CallTo(() => _itemFactoryMock.CreateTranslationOrigin()).Returns(_translationOriginMmock); _sourceSegment0Mock = A.Fake <ISegment>(); _targetSegment0Mock = A.Fake <ISegment>(); _sourceSegment1Mock = A.Fake <ISegment>(); _targetSegment1Mock = A.Fake <ISegment>(); _sourceSegment2Mock = A.Fake <ISegment>(); _targetSegment2Mock = A.Fake <ISegment>(); _sourceSegment3Mock = A.Fake <ISegment>(); _targetSegment3Mock = A.Fake <ISegment>(); A.CallTo(() => _itemFactoryMock.CreateSegment(A <ISegmentPairProperties> .Ignored)) .ReturnsNextFromSequence( _sourceSegment0Mock, _targetSegment0Mock, _sourceSegment1Mock, _targetSegment1Mock, _sourceSegment2Mock, _targetSegment2Mock, _sourceSegment3Mock, _targetSegment3Mock ); var textPropertiesMsgidMock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message id")).Returns(textPropertiesMsgidMock); var textPropertiesMsgidPluralMock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message id plural")) .Returns(textPropertiesMsgidPluralMock); var textPropertiesMsgstrMock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message string")) .Returns(textPropertiesMsgstrMock); var textPropertiesMsgstr0Mock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message string 0")) .Returns(textPropertiesMsgstr0Mock); var textPropertiesMsgstr1Mock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message string 1")) .Returns(textPropertiesMsgstr1Mock); var textPropertiesMsgstr2Mock = A.Fake <ITextProperties>(); A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("message string 2")) .Returns(textPropertiesMsgstr2Mock); _textMsgidMock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgidMock)).Returns(_textMsgidMock); _textMsgidPluralMock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgidPluralMock)).Returns(_textMsgidPluralMock); _textMsgstrMock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgstrMock)).Returns(_textMsgstrMock); _textMsgstr0Mock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgstr0Mock)).Returns(_textMsgstr0Mock); _textMsgstr1Mock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgstr1Mock)).Returns(_textMsgstr1Mock); _textMsgstr2Mock = A.Fake <IText>(); A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMsgstr2Mock)).Returns(_textMsgstr2Mock); }
public DecryptSegmentVisitor(IDocumentItemFactory documentItemFactory, IPropertiesFactory propertiesFactory, AnonymizerSettings decryptSettings) { _documentItemFactory = documentItemFactory; _propertiesFactory = propertiesFactory; _decryptSettings = decryptSettings; }