public async Task IsGrainWithChildren_Deep_ReturnsGrainWithChildrenAsync() { // Arrange var mockGrainStore = new Mock <IGrainStore>() .SetupGetAllGrain(GetGrainWithDeepGraph()) .Object; var subject = new GrainService(mockGrainStore); // Act var actualResult = await subject.GetAllGrains(); // Assert var first = actualResult.First(g => g.Name == "shared"); Assert.True(first.SecurableItems.Count == 2); Assert.True(first.IsSecurableItemChildOfGrain("level_one_a")); Assert.True(first.IsSecurableItemChildOfGrain("level_one_b")); Assert.True(first.IsSecurableItemChildOfGrain("level_two")); Assert.True(first.IsSecurableItemChildOfGrain("level_three_a")); Assert.True(first.IsSecurableItemChildOfGrain("level_three_b")); var second = actualResult.First(g => g.Name == "shared2"); Assert.True(second.SecurableItems.Count == 2); Assert.True(second.IsSecurableItemChildOfGrain("level_one_a2")); Assert.True(second.IsSecurableItemChildOfGrain("level_one_b2")); Assert.True(second.IsSecurableItemChildOfGrain("level_two2")); Assert.True(second.IsSecurableItemChildOfGrain("level_three_a2")); Assert.True(second.IsSecurableItemChildOfGrain("level_three_b2")); }
private async Task <dynamic> GetGrain() { CheckReadAccess(); return((await _grainService.GetAllGrains()).ToGrainApiModels()); }