public async Task<Dictionary<string, JsonValue>> GetContext(Identity identity) { using (_metrics.Measure.Timer.Time(_getContextTimer)) { return await _contextDriver.GetContext(identity); } }
public async Task GivenMockReadersAndWriters_GetContextCalled_ReturnsExpectedResult() { Setup(); var expectedResult = new Dictionary <string, JsonValue> { { "id", JsonValue.NewString("1") }, { "some_key", JsonValue.NewString("some_value") }, }; A.CallTo(() => _someFakeDriver.GetContext(A <Identity> .That.IsEqualTo(_fakeIdentity))) .ThrowsAsync(new Exception()); A.CallTo(() => _someOtherFakeDriver.GetContext(A <Identity> .That.IsEqualTo(_fakeIdentity))).Returns(expectedResult); Assert.Equal(await _multiContextDriver.GetContext(_fakeIdentity), expectedResult); A.CallTo(() => _someFakeDriver.GetContext(A <Identity> .That.IsEqualTo(_fakeIdentity))).MustHaveHappened(); }
public async Task <ActionResult> GetContext([FromRoute] string identityType, [FromRoute] string identityId) { if (!User.IsTweekIdentity()) { return(Forbid()); } var identity = new Identity(identityType, identityId); var contextData = await _contextDriver.GetContext(identity); return(Json(contextData)); }
public Task <Dictionary <string, JsonValue> > GetContext(Identity identity) => _child.GetContext(identity);