public async Task Should_resolve_app_by_id() { var expected = SetupApp(0, false); var actual = await sut.GetAppAsync(appId.Id); Assert.Same(expected, actual); }
public async Task Should_resolve_app_by_name() { var expected = SetupApp(0, false); A.CallTo(() => indexByName.GetIdAsync(appId.Name)) .Returns(appId.Id); var actual = await sut.GetAppAsync(appId.Name); Assert.Same(expected, actual); }
public async Task Should_resolve_app_by_name_and_id_if_cached_before() { var(expected, _) = SetupApp(); A.CallTo(() => indexByName.GetIdAsync(appId.Name)) .Returns(appId.Id); var actual1 = await sut.GetAppByNameAsync(appId.Name, true); var actual2 = await sut.GetAppByNameAsync(appId.Name, true); var actual3 = await sut.GetAppAsync(appId.Id, true); Assert.Same(expected, actual1); Assert.Same(expected, actual2); Assert.Same(expected, actual3); A.CallTo(() => grainFactory.GetGrain <IAppGrain>(appId.Id.ToString(), null)) .MustHaveHappenedOnceExactly(); A.CallTo(() => indexByName.GetIdAsync(A <string> ._)) .MustHaveHappenedOnceExactly(); }
public async Task Should_resolve_app_by_name() { var(expected, _) = CreateApp(); A.CallTo(() => cache.GetAppIdsAsync(A <string[]> .That.Is(appId.Name))) .Returns(new List <DomainId> { appId.Id }); var actual1 = await sut.GetAppAsync(appId.Name, false); var actual2 = await sut.GetAppAsync(appId.Name, false); Assert.Same(expected, actual1); Assert.Same(expected, actual2); A.CallTo(() => grainFactory.GetGrain <IAppGrain>(appId.Id.ToString(), null)) .MustHaveHappenedTwiceExactly(); A.CallTo(() => cache.GetAppIdsAsync(A <string[]> ._)) .MustHaveHappenedTwiceExactly(); }