Пример #1
0
        public ExecuteHttpTriggerTests()
        {
            var context = new DefaultHttpContext();

            _request = context.Request;

            _ContentTypeNameMapConfig = A.Fake <IOptionsMonitor <ContentApiOptions> >();
            A.CallTo(() => _ContentTypeNameMapConfig.CurrentValue).Returns(new ContentApiOptions
            {
                ContentTypeNameMap = new Dictionary <string, string>()
                {
                    { "test1", "Test2" }, { "test2", "Test3" }
                }
            });

            _graphCluster = A.Fake <IGraphCluster>();
            var fakeGraphClusterBuilder = A.Fake <IGraphClusterBuilder>();

            A.CallTo(() => fakeGraphClusterBuilder.Build(null)).Returns(_graphCluster);

            _log        = A.Fake <ILogger>();
            _jsonHelper = A.Fake <IJsonFormatHelper>();

            _jsonHelper      = new JsonFormatHelper(_ContentTypeNameMapConfig);
            _executeFunction = new Execute(_ContentTypeNameMapConfig, fakeGraphClusterBuilder, _jsonHelper);
        }
 public Execute(IOptionsMonitor <ContentApiOptions> contentApiOptions, IGraphClusterBuilder graphClusterBuilder, IJsonFormatHelper jsonFormatHelper)
 {
     _contentApiOptions = contentApiOptions ?? throw new ArgumentNullException(nameof(contentApiOptions));
     _graphCluster      = graphClusterBuilder.Build() ?? throw new ArgumentNullException(nameof(graphClusterBuilder));
     _jsonFormatHelper  = jsonFormatHelper ?? throw new ArgumentNullException(nameof(jsonFormatHelper));
 }