public void AddsItselfToObjectContext() { var context = new PhraseContext(); dynamic obj = context.CreateObject(); Assert.Equal(context, obj.BaseContext); }
public void AddingTheSameValueUpdatesThatValue() { var context = new PhraseContext(); context.Add("name", "Bob"); context.Add("name", "Joe"); Assert.Equal("Joe", context.GetValue <string>("name")); }
public void CanAddAndRetrievePropertiesToContext() { var context = new PhraseContext(); context.Add("name", "Bob"); context.Add("age", 15); Assert.Equal("Bob", context.GetValue <string>("name")); Assert.Equal(15, context.GetValue <int>("age")); }
public UnitOfWorkCommandHandlerDecorator( ICommandHandler <T> decorated, IUnitOfWork unitOfWork, PhraseContext phraseContext) { _decorated = decorated; _unitOfWork = unitOfWork; _phraseContext = phraseContext; }
public NewPhraseWindow(PhraseContext context) { InitializeComponent(); _context = context; DataContext = CurrentPhrase; Visibility = Visibility.Hidden; Closing += OnClosing; MoveToLowerRightCorner(); }
public PhraseEditorWindow(PhraseContext context) { InitializeComponent(); _context = context; _context.Phrases.Load(); AppDataGrid.DataContext = _context.Phrases.Local.ToObservableCollection(); Visibility = Visibility.Hidden; Closing += OnClosing; }
public void CanInitializeLikeADictionary() { var context = new PhraseContext() { { "name", "Bob" }, { "age", 28 } }; Assert.Equal("Bob", context.GetValue <string>("name")); Assert.Equal(28, context.GetValue <int>("age")); }
public void CanCreateAnObjectWithPropertiesForValues() { var context = new PhraseContext(); context.Add("name", "Bob"); context.Add("age", 28); dynamic obj = context.CreateObject(); Assert.Equal("Bob", obj.name); Assert.Equal(28, obj.age); }
public void PhrasesCanCompileTemplates() { var template = "Hello {{name}}."; var phrase = new PhraseTemplate(template); var context = new PhraseContext() { { "name", "Bob" } }; var result = phrase.WritePhrase(context); Assert.Equal("Hello Bob.", result); }
public void PhrasesCanCascadeCallsToOtherTemplatesIfNecessary() { var template = "Good Day, {{name}}."; var phrase = new PhraseTemplate(template); var context = new PhraseContext() { { "name", "{{fullname}}" }, { "fullname", "Bob Woodward" } }; var result = phrase.WritePhrase(context); Assert.Equal("Good Day, Bob Woodward.", result); }
public void ChoosingAWordAddsToContextIfPossible() { var color = new Descriptor("color", new string[] { "Red" }); var gateway = EntityGateway <Descriptor> .LoadWithSingleItem(color); var choose = ChooseDescriptor.CreateIsolatedForUnitTesting(gateway, "choose-testing"); var handleBarsTemplate = Handlebars.Compile("{{choose-testing \"color\"}}"); var context = new PhraseContext(); dynamic contextObj = context.CreateObject(); var result = handleBarsTemplate(contextObj); Assert.Equal("Red", context.GetValue <string>("color")); Assert.Equal("Red", contextObj.color); }
public PhraseContext phrase() { PhraseContext _localctx = new PhraseContext(Context, State); EnterRule(_localctx, 2, RULE_phrase); try { State = 51; ErrorHandler.Sync(this); switch (Interpreter.AdaptivePredict(TokenStream, 3, Context)) { case 1: EnterOuterAlt(_localctx, 1); { State = 48; keyword(); } break; case 2: EnterOuterAlt(_localctx, 2); { State = 49; attributeFilter(); } break; case 3: EnterOuterAlt(_localctx, 3); { State = 50; rangeFilter(); } break; } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public override string VisitPhrase(PhraseContext context) { var posList = context.pos().Select(VisitPos).ToList(); return($"{string.Join(" ",posList)}."); }
public PhraseRepo(PhraseContext context) : base(context) { }
public BaseRepo() { Context = new PhraseContext(); }
public BaseRepo(PhraseContext context) { Context = context; }
public OutboxAccessor(PhraseContext phraseContext) { _phraseContext = phraseContext; }
public PhraseRepository(PhraseContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public DomainEventsAccessor(PhraseContext context) { _context = context; }