コード例 #1
0
            protected override void Arrange()
            {
                // Initialize dependencies

                // Create details for an invalid token (no API key assigned)
                _suppliedInvalidClientDetails = new ApiClientDetails();

                _decoratedValidator = Stub <IOAuthTokenValidator>();

                _decoratedValidator
                .Stub(x => x.GetClientDetailsForTokenAsync(_suppliedInvalidApiToken))
                .Return(Task.FromResult(_suppliedInvalidClientDetails));

                _cacheProvider = Stub <ICacheProvider>();

                // Mock config file to return duration
                _configValueProvider = Stub <IConfigValueProvider>();

                _configValueProvider.Stub(x => x.GetValue(Arg <string> .Is.Anything))
                .Return(_suppliedDurationMinutes.ToString());
            }
コード例 #2
0
            protected override void Arrange()
            {
                // Initialize dependencies
                _suppliedCachedClientDetails = new ApiClientDetails();

                _decoratedValidator = Stub <IOAuthTokenValidator>();

                // Fake the cache to return the details
                _cacheProvider = Stub <ICacheProvider>();

                _cacheProvider.Stub(
                    x =>
                    x.TryGetCachedObject(
                        Arg <string> .Is.Anything,
                        out Arg <object> .Out(_suppliedCachedClientDetails)
                        .Dummy))
                .Return(true);

                // Mock config file to return duration
                _configValueProvider = Stub <IConfigValueProvider>();

                _configValueProvider.Stub(x => x.GetValue(Arg <string> .Is.Anything))
                .Return(_suppliedDurationMinutes.ToString());
            }
コード例 #3
0
            protected override void Arrange()
            {
                AssemblyLoader.EnsureLoaded <Marker_EdFi_Ods_Test_TestExtension>();

                _registrarStub = mocks.DynamicMock <IEntityExtensionRegistrar>();

                _assembliesProviderStub = Stub <IAssembliesProvider>();

                _assembliesProviderStub.Stub(x => x.GetAssemblies())
                .Return(
                    new Assembly[]
                {
                    new FakeExtensionAssembly(typeof(Marker_EdFi_Ods_Test_TestExtension))
                });

                _container = new WindsorContainer();

                _domainModelProvider = new DomainModelProvider(
                    new IDomainModelDefinitionsProvider[]
                {
                    new EdFiDomainModelDefinitionsProvider(), new DomainModelDefinitionsProvider()
                });

                _container.Register(
                    Component.For <IDomainModelProvider>()
                    .Instance(_domainModelProvider));

                _configValueStub = Stub <IConfigValueProvider>();

                _configValueStub.Stub(x => x.GetValue(ExcludedExtensionSources))
                .Return(default(string));

                _container.Register(
                    Component.For <IConfigValueProvider>()
                    .Instance(_configValueStub));
            }