本文整理汇总了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>();
}
示例2: TestInitialize
public void TestInitialize()
{
_fakeBuilder = new FakeClassBuilder<FriendshipQueryExecutor>();
_fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
_fakeUserQueryValidator = _fakeBuilder.GetFake<IUserQueryValidator>();
_fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
}
示例3: TestInitialize
public void TestInitialize()
{
_fakeBuilder = new FakeClassBuilder<TweetQueryGenerator>();
_fakeGeoQueryGenerator = _fakeBuilder.GetFake<IGeoQueryGenerator>();
_fakeTweetQueryValidator = _fakeBuilder.GetFake<ITweetQueryValidator>();
_fakeTwitterStringFormatter = _fakeBuilder.GetFake<ITwitterStringFormatter>();
}
示例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);
}
示例5: CloseServiceRequiresOpenServiceControlManager
public void CloseServiceRequiresOpenServiceControlManager(Fake<IAdvApi32> advApi32)
{
var sut = new ServiceConnection(advApi32.FakedObject);
var connectionHandle = new ConnectionHandle();
Assert.Throws<MissingServiceManagerConnectionException>(() => sut.Close(connectionHandle));
}
示例6: TestInitialize
public void TestInitialize()
{
_fakeBuilder = new FakeClassBuilder<FriendshipJsonController>();
_fakeFriendshipQueryGenerator = _fakeBuilder.GetFake<IFriendshipQueryGenerator>();
_fakeFriendshipFactory = _fakeBuilder.GetFake<IFriendshipFactory>();
_fakeTwitterAccessor = _fakeBuilder.GetFake<ITwitterAccessor>();
ArrangeFriendshipFactoryAuthorizations();
}
示例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>();
}
示例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();
}
示例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();
}
示例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
}
示例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);
}
示例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);
}
示例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
}
示例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();
}
示例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);
}