本文整理汇总了C#中StoryTeller.Model.FixtureLibrary.ApplyOverrides方法的典型用法代码示例。如果您正苦于以下问题:C# FixtureLibrary.ApplyOverrides方法的具体用法?C# FixtureLibrary.ApplyOverrides怎么用?C# FixtureLibrary.ApplyOverrides使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoryTeller.Model.FixtureLibrary
的用法示例。
在下文中一共展示了FixtureLibrary.ApplyOverrides方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: copies_grammars
public void copies_grammars()
{
const string fixtureKey = "a key";
var lib = new FixtureLibrary();
var original = new FixtureModel(fixtureKey);
lib.Models[fixtureKey] = original;
original.AddGrammar(new Sentence { key = "sentence", format = "a format"});
var overrides = new FixtureLibrary();
var overriden = new FixtureModel(fixtureKey);
overrides.Models[fixtureKey] = overriden;
var result = lib.ApplyOverrides(overrides);
result.Models.Count.ShouldBe(1);
var fixture = result.Models[fixtureKey];
ReferenceEquals(fixture, overrides.Models[fixtureKey]).ShouldBeFalse();
fixture.key.ShouldBe(fixtureKey);
fixture.grammars.Length.ShouldBe(1);
var sentence = fixture.grammars[0] as Sentence;
sentence.key.ShouldBe("sentence");
sentence.format.ShouldBe("a format");
}
示例2: tracks_when_a_fixture_is_missing_from_code
public void tracks_when_a_fixture_is_missing_from_code()
{
const string key = "a key";
var lib = new FixtureLibrary();
var overrides = new FixtureLibrary();
overrides.Models[key] = new FixtureModel(key);
var result = lib.ApplyOverrides(overrides);
result.Models[key].IsMissing.ShouldBeTrue();
}
示例3: copies_from_overrides_when_not_in_original
public void copies_from_overrides_when_not_in_original()
{
const string key = "a key";
var lib = new FixtureLibrary();
var overrides = new FixtureLibrary();
overrides.Models[key] = new FixtureModel(key);
var result = lib.ApplyOverrides(overrides);
result.Models.Count.ShouldBe(1);
var fixture = result.Models[key];
fixture.key.ShouldBe(key);
}
示例4: overrides_original_title
public void overrides_original_title()
{
const string key = "a key";
var lib = new FixtureLibrary();
var original = new FixtureModel(key);
original.title = "A title";
original.implementation = "some implementation";
lib.Models[key] = original;
var overrides = new FixtureLibrary();
var overriden = new FixtureModel(key);
overriden.title = "A new title";
overrides.Models[key] = overriden;
var result = lib.ApplyOverrides(overrides);
result.Models.Count.ShouldBe(1);
var fixture = result.Models[key];
ReferenceEquals(fixture, overrides.Models[key]).ShouldBeFalse();
fixture.title.ShouldBe(overriden.title);
fixture.implementation.ShouldBe(original.implementation);
}