当前位置: 首页>>代码示例>>C#>>正文


C# FakeItEasy.Fake类代码示例

本文整理汇总了C#中FakeItEasy.Fake的典型用法代码示例。如果您正苦于以下问题:C# Fake类的具体用法?C# Fake怎么用?C# Fake使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Fake类属于FakeItEasy命名空间,在下文中一共展示了Fake类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestInitialize

 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<UserController>();
     _fakeUserQueryExecutor = _fakeBuilder.GetFake<IUserQueryExecutor>();
     _fakeTweetFactory = _fakeBuilder.GetFake<ITweetFactory>();
     _fakeUserFactory = _fakeBuilder.GetFake<IUserFactory>();
 }
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:7,代码来源:UserControllerTests.cs

示例2: TestInitialize

 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<FriendshipQueryExecutor>();
     _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
     _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
     _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
 }
开发者ID:SowaLabs,项目名称:Tweetinvi-obsolete,代码行数:7,代码来源:FriendshipQueryExecutorTests.cs

示例3: TestInitialize

 public void TestInitialize()
 {
     _fakeBuilder = new FakeClassBuilder<TweetQueryGenerator>();
     _fakeGeoQueryGenerator = _fakeBuilder.GetFake<IGeoQueryGenerator>();
     _fakeTweetQueryValidator = _fakeBuilder.GetFake<ITweetQueryValidator>();
     _fakeTwitterStringFormatter = _fakeBuilder.GetFake<ITwitterStringFormatter>();
 }
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:7,代码来源:TweetQueryGeneratorTests.cs

示例4: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitCacheManager>();
            _fakeRateLimitCache = _fakeBuilder.GetFake<IRateLimitCache>();
            _fakeRateLimitHelper = _fakeBuilder.GetFake<IRateLimitHelper>();
            _fakeTwitterRequester = _fakeBuilder.GetFake<ITwitterRequester>();
            _fakeHelpQueryGenerator = _fakeBuilder.GetFake<IHelpQueryGenerator>();
            _fakeJsonObjectConverter = _fakeBuilder.GetFake<IJsonObjectConverter>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();
            _fakeTwitterQueryFactory = _fakeBuilder.GetFake<ITwitterQueryFactory>();

            InitializeData();

            _fakeRateLimitHelper.CallsTo(x => x.GetEndpointRateLimitFromQuery(TEST_QUERY, _credentialsRateLimits)).Returns(_endpointRateLimit);
            _fakeRateLimitCache.CallsTo(x => x.GetCredentialsRateLimits(_credentials)).Returns(_credentialsRateLimits);

            _fakeRateLimitCache.CallsTo(x => x.RefreshEntry(_credentials, _credentialsRateLimits)).Invokes(() =>
            {
                _fakeRateLimitCache.CallsTo(x => x.GetCredentialsRateLimits(_credentials)).Returns(_refreshedCredentialsRateLimits);
                _fakeRateLimitHelper.CallsTo(x => x.GetEndpointRateLimitFromQuery(TEST_QUERY, _refreshedCredentialsRateLimits)).Returns(_refreshedEndpointRateLimit);
            });

            _fakeCredentialsAccessor.SetupPassThrough<ICredentialsRateLimits>();

            _fakeHelpQueryGenerator.CallsTo(x => x.GetCredentialsLimitsQuery()).Returns(TEST_QUERY);

            _fakeTwitterRequester.CallsTo(x => x.ExecuteQuery(_twitterQuery, null)).Returns(TEST_QUERY);
            _fakeJsonObjectConverter.CallsTo(x => x.DeserializeObject<ICredentialsRateLimits>(TEST_QUERY, It.IsAny<JsonConverter[]>())).ReturnsNextFromSequence(_credentialsRateLimits, _credentialsRateLimits2);

            _fakeTwitterQueryFactory.CallsTo(x => x.Create(TEST_QUERY, It.IsAny<HttpMethod>(), It.IsAny<ITwitterCredentials>())).Returns(_twitterQuery);
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:31,代码来源:RateLimitCacheManagerTests.cs

示例5: CloseServiceRequiresOpenServiceControlManager

        public void CloseServiceRequiresOpenServiceControlManager(Fake<IAdvApi32> advApi32)
        {
            var sut = new ServiceConnection(advApi32.FakedObject);

            var connectionHandle = new ConnectionHandle();

            Assert.Throws<MissingServiceManagerConnectionException>(() => sut.Close(connectionHandle));
        }
开发者ID:SleddogSoftwareDevelopment,项目名称:ExtendedTrail,代码行数:8,代码来源:ServiceConnectionTests.cs

示例6: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<FriendshipJsonController>();
            _fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
            _fakeFriendshipFactory = _fakeBuilder.GetFake<IFriendshipFactory>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();

            ArrangeFriendshipFactoryAuthorizations();
        }
开发者ID:SowaLabs,项目名称:Tweetinvi-obsolete,代码行数:9,代码来源:FriendshipJsonControllerTests.cs

示例7: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<UserQueryExecutor>();
            _fakeUserQueryGenerator = _fakeBuilder.GetFake<IUserQueryGenerator>();
            _fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
            _fakeWebHelper = _fakeBuilder.GetFake<IWebHelper>();

            _cursorQueryIds = new List<long>();
        }
开发者ID:SowaLabs,项目名称:Tweetinvi-obsolete,代码行数:9,代码来源:UserQueryExecutorTests.cs

示例8: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<FriendshipQueryGenerator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake<IUserQueryParameterGenerator>();
            _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateIdOrScreenNameParameter();
            _fakeUserQueryValidator.ArrangeIsUserIdValid();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:11,代码来源:FriendshipQueryGeneratorTests.cs

示例9: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<MessageQueryGenerator>();
            _fakeMessageQueryValidator = _fakeBuilder.GetFake<IMessageQueryValidator>();
            _fakeUserQueryParameterGenerator = _fakeBuilder.GetFake<IUserQueryParameterGenerator>();
            _fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
            _fakeTwitterStringFormatter = _fakeBuilder.GetFake<ITwitterStringFormatter>();

            _fakeUserQueryParameterGenerator.ArrangeGenerateIdParameter();
            _fakeUserQueryParameterGenerator.ArrangeGenerateScreenNameParameter();
        }
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:11,代码来源:MessageQueryGeneratorTests.cs

示例10: SpecificationIsCorrectWhenInitializedWithSpecification

 public void SpecificationIsCorrectWhenInitializedWithSpecification()
 {
     // Fixture setup
     var expected = new Fake<IRequestSpecification>().FakedObject;
     var sut = new FakeItEasyRelay(expected);
     // Exercise system
     IRequestSpecification result = sut.FakeableSpecification;
     // Verify outcome
     Assert.Equal(expected, result);
     // Teardown
 }
开发者ID:jpierson,项目名称:AutoFixture,代码行数:11,代码来源:FakeItEasyRelayTest.cs

示例11: UsesFallbackWhenIsSet

        public void UsesFallbackWhenIsSet()
        {
            const string someid = "SomeId";
            var mock = new Fake<ILocalizationService>();
            mock.CallsTo(loc => loc.GetString(IdSrvConstants.Messages, someid)).Returns("fallbackValue");
            
            var service = new GlobalizedLocalizationService(new LocaleOptions{ Locale = "nb-NO", FallbackLocalizationService = mock.FakedObject});

            var result = service.GetString(IdSrvConstants.Messages, someid);
            Assert.Equal("fallbackValue", result);
        }
开发者ID:ryanmar,项目名称:IdentityServer3.Contrib.Localization,代码行数:11,代码来源:TheService.cs

示例12: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<RateLimitUpdater>();
            _fakeRateLimitCacheManager = _fakeBuilder.GetFake<IRateLimitCacheManager>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();

            InitializeData();

            _fakeRateLimitCacheManager.CallsTo(x => x.GetQueryRateLimit(TEST_QUERY, _credentials)).Returns(_endpointRateLimit);
            _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_credentials);
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:11,代码来源:RateLimitUpdaterTests.cs

示例13: CreateWithNonAbstractionRequestReturnsCorrectResult

 public void CreateWithNonAbstractionRequestReturnsCorrectResult(object request)
 {
     // Fixture setup
     var sut = new FakeItEasyRelay();
     var dummyContext = new Fake<ISpecimenContext>().FakedObject;
     // Exercise system
     var result = sut.Create(request, dummyContext);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
开发者ID:jpierson,项目名称:AutoFixture,代码行数:12,代码来源:FakeItEasyRelayTest.cs

示例14: TestInitialize

        public void TestInitialize()
        {
            _fakeBuilder = new FakeClassBuilder<LoggedUser>();
            _fakeCredentialsAccessor = _fakeBuilder.GetFake<ICredentialsAccessor>();
            _fakeTimelineController = _fakeBuilder.GetFake<ITimelineController>();
            _fakeFriendshipController = _fakeBuilder.GetFake<IFriendshipController>();
            _fakeSavedSearchController = _fakeBuilder.GetFake<ISavedSearchController>();
            _fakeMessageController = _fakeBuilder.GetFake<IMessageController>();
            _fakeTweetController = _fakeBuilder.GetFake<ITweetController>();
            _fakeAccountController = _fakeBuilder.GetFake<IAccountController>();

            InitData();
        }
开发者ID:SowaLabs,项目名称:Tweetinvi-obsolete,代码行数:13,代码来源:LoggedUserTests.cs

示例15: OpenServiceManagerGetsCorrectConnectionHandle

        public void OpenServiceManagerGetsCorrectConnectionHandle(Fake<IAdvApi32> advApi32, long pointerValue)
        {
            advApi32.CallsTo(_ => _.OpenServiceControlManager(A<string>._, A<string>._, A<ScmAccess>._))
                    .Returns(new IntPtr(pointerValue));

            var sut = new ServiceDatabaseConnection(advApi32.FakedObject);

            var connectionHandle = sut.Open();

            var actual = connectionHandle.ServiceManagerHandle;
            var expected = new IntPtr(pointerValue);

            Assert.Equal(expected, actual);
        }
开发者ID:SleddogSoftwareDevelopment,项目名称:ExtendedTrail,代码行数:14,代码来源:ServiceDatabaseConnectionTests.cs


注:本文中的FakeItEasy.Fake类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。