Exemple #1
0
        public async Task FromModels_DetailsAreComplete()
        {
            // Arrange
            var models = new[]
            {
                GetBlogPost("first"),
                GetBlogPost("second")
            };

            // Act
            ILoadLinkDetails details = null;
            var result = await _sut.LoadLink <BlogPostLinkedSource>().EnableDebugMode(x => details = x).FromModelsAsync(models);

            // Assert
            details.CallDetails.Method.Should().Be("FromModelsAsync");
            details.CallDetails.Values.Should().Equal(models);

            details.LinkedSourceModelType.Should().Be <BlogPost>();
            details.LinkedSourceType.Should().Be <BlogPostLinkedSource>();

            details.Result.Should().BeEquivalentTo(result);

            details.Took.Should().NotBeNull();

            details.Steps.Should().HaveCount(3);
            details.CurrentStep.Should().Be(details.Steps[2]);

            VerifyFirstStep(details.Steps[0], models);
            VerifySecondStep(details.Steps[1], models);
            VerifyThirdStep(details.Steps[2], models);
        }
Exemple #2
0
 public LoadingContext(IReadOnlyDictionary <Type, IReadOnlyList <object> > lookupIds, DataStore dataStore, ILoadLinkDetails loadLinkDetails = null)
 {
     _dataStore      = dataStore;
     _lookupIds      = lookupIds;
     LoadLinkDetails = loadLinkDetails;
 }