Exemple #1
0
            public TestBase()
            {
                _typeCache    = Substitute.For <ITypeCache>();
                _referenceMap = Substitute.For <IReferenceMap>();
                _converter    = new JsiiToFrameworkConverter(_typeCache);

                IServiceCollection serviceCollection = new ServiceCollection();

                serviceCollection.AddSingleton <ITypeCache>(_typeCache);
                serviceCollection.AddSingleton <IReferenceMap>(_referenceMap);
                serviceCollection.AddSingleton <IJsiiToFrameworkConverter>(_converter);

                IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

                ServiceContainer.ServiceProviderOverride = serviceProvider;

                _typeCache.GetFrameworkType(Arg.Is <TypeReference>(r => r.Primitive == PrimitiveType.Any)).Returns(typeof(object));
                _typeCache.GetFrameworkType(Arg.Is <TypeReference>(r => r.Primitive == PrimitiveType.String)).Returns(typeof(string));
            }