本文整理汇总了C#中IFixture.Customize方法的典型用法代码示例。如果您正苦于以下问题:C# IFixture.Customize方法的具体用法?C# IFixture.Customize怎么用?C# IFixture.Customize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFixture
的用法示例。
在下文中一共展示了IFixture.Customize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Customize
public void Customize(IFixture fixture)
{
ControllerDescriptor(fixture);
ActionDescriptor(fixture);
ActionExecutedContext(fixture);
ActionExecutingContext(fixture);
ViewEngineResult(fixture);
ViewContext(fixture);
ControllerBase(fixture);
IValueProvider(fixture);
ModelBindingContext(fixture);
ValueProviderResult(fixture);
fixture.Customize<ControllerContext>(cc => cc.Without(c => c.DisplayMode));
fixture.Customize<ExceptionContext>(ec => ec.Without(c => c.DisplayMode));
fixture.Customize<ResultExecutedContext>(rec => rec.Without(c => c.DisplayMode));
fixture.Customize<AuthorizationContext>(ac => ac.Without(c => c.DisplayMode));
fixture.Customize<ResultExecutingContext>(rec => rec.Without(c => c.DisplayMode));
fixture.Register<HttpContextBase>(
() =>
{
var mock = new Mock<HttpContextBase>();
mock.Setup(m => m.Items).Returns(new Dictionary<string, object>());
return mock.Object;
});
}
示例2: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<LibraryCard>(x => x.Without(y => y.Id).Without(y => y.Loans));
fixture.Customize<Author>(x => x.Without(y => y.Id));
fixture.Customize<Book>(x => x.Without(y => y.Id).Without(y => y.Authors));
fixture.Customize(new MultipleCustomization());
}
示例3: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<VoIPTransport>(x => x.FromFactory<ITransportApiProvider>(t => new UdpTransport(t)));
fixture.Customize<Account>(x => x.OmitAutoProperties());
var account = fixture.Freeze<Mock<Account>>();
account.SetupGet(x => x.Id).Returns(fixture.CreateAnonymous<int>());
fixture.Register(() => account.Object);
}
示例4: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<JournaledEvent>(composer => composer
.FromFactory(() => JournaledEvent.Create(
new object(),
(_, type, writer) => writer.WriteLine(fixture.Create("EventPayload")))));
fixture.Customize<IReadOnlyList<JournaledEvent>>(composer => composer
.FromFactory((JournaledEvent[] events) => events));
}
示例5: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<InMemoryMessageStore>(c =>
c.FromFactory(new MethodInvoker(new GreedyConstructorQuery())));
fixture.Customize<InMemoryMessageChannel>(c =>
c.FromFactory(new MethodInvoker(new GreedyConstructorQuery())));
fixture.Customize<InMemoryMessageChannel>(c =>
c.FromFactory(new MethodInvoker(new GreedyConstructorQuery())));
}
示例6: Customize
public void Customize(IFixture fixture)
{
var settings = new SettingsHolder();
settings.SetDefault("EndpointName", "UnitTests");
var config = new PersistenceExtentions<MongoDBPersistence>(settings);
fixture.Register(() => settings);
fixture.Register(() => config);
fixture.Customize<Address>(c => c.FromFactory(new MethodInvoker(new GreedyConstructorQuery())));
fixture.Customize<TimeoutData>(
c => c.With(t => t.OwningTimeoutManager, config.GetSettings().EndpointName()));
}
示例7: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<ViewDataDictionary>(c =>
c.Without(vdd => vdd.ModelMetadata));
fixture.Customize<HttpContextBase>(ob => ob
.FromFactory(() =>
{
var contextStub = new Mock<HttpContextBase>();
contextStub.SetupProperty(ctx => ctx.User);
contextStub.Object.User = fixture.CreateAnonymous<IPrincipal>();
return contextStub.Object;
})
.OmitAutoProperties());
}
示例8: Customize
/// <summary>
/// Customizes the specified fixture by adding the Sitecore specific specimen builders.
/// </summary>
/// <param name="fixture">The fixture to customize.</param>
public void Customize(IFixture fixture)
{
fixture.Freeze<Db>();
fixture.Customize(new ContextDatabaseCustomization());
fixture.Customizations.Add(
new CompositeSpecimenBuilder(
new ItemSpecimenBuilder(),
new FilteringSpecimenBuilder(
new Postprocessor(
new ContentAttributeRelay(),
new AddContentDbItemCommand()),
new DbItemParameterSpecification()),
new FilteringSpecimenBuilder(
new Postprocessor(
new ContentAttributeRelay(),
new AddContentItemCommand()),
new ItemParameterSpecification()),
new FilteringSpecimenBuilder(
new Omitter(),
new PropertySpecification(typeof(ID), "ParentID")),
new FilteringSpecimenBuilder(
new Omitter(),
new PropertySpecification(typeof(ID), "TemplateID")),
new FilteringSpecimenBuilder(
new Omitter(),
new PropertySpecification(typeof(ID[]), "BaseIDs"))
));
}
示例9: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<Call>(x => x.OmitAutoProperties());
fixture.Freeze<Mock<ICallManagerInternal>>();
var call = fixture.Freeze<Mock<Call>>();
fixture.Register(() => call.Object);
}
示例10: Customize
public void Customize(IFixture fixture)
{
fixture.Customize(
new CompositeCustomization(
new MultipleCustomization(),
new AutoMoqCustomization()));
}
示例11: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<HttpRequestMessage>(c => c
.Without(x => x.Content)
.Do(x => x.Properties[HttpPropertyKeys.HttpConfigurationKey] =
new HttpConfiguration()));
}
示例12: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<HttpConfiguration>(
c => c
.OmitAutoProperties()
.Do(config => config.MapHttpAttributeRoutes()));
}
示例13: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<ModelBindingContext>(c => c
.Without(x => x.Model)
.Without(x => x.ModelType));
fixture.Inject(CultureInfo.CurrentCulture);
}
示例14: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<ConvertToClaimRulesCommand>(c =>
c
.OmitAutoProperties()
.With(cmd => cmd.RoleAssignmentFile, ".\\PPJ rettigheder 2013.10.08.xlsx")
);
}
示例15: Customize
public void Customize(IFixture fixture)
{
fixture.Customize<DummyModel>(x => x.FromFactory(() => {
var output = new Mock<DummyModel>() { CallBase = true };
output.As<IModel>();
return output.Object;
}));
}