本文整理汇总了C#中Destination类的典型用法代码示例。如果您正苦于以下问题:C# Destination类的具体用法?C# Destination怎么用?C# Destination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Destination类属于命名空间,在下文中一共展示了Destination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildren
public List<Destination> GetChildren(string atlasId)
{
var childList = new List<Destination>();
_stream.Seek(0,0);
var element = XElement.Load(_stream);
var targetElement = element.Descendants("node").FirstOrDefault(n => n.Attribute("atlas_node_id") != null && n.Attribute("atlas_node_id").Value == atlasId);
if (targetElement != null)
{
var childNodeTags = targetElement.Elements("node");
foreach (var childNodeTag in childNodeTags)
{
var desination = new Destination();
var atlasIdAttribute = childNodeTag.Attribute("atlas_node_id");
if (atlasIdAttribute != null)
{
desination.AtlasId = atlasIdAttribute.Value;
}
var nameElement = childNodeTag.Element("node_name");
if(nameElement != null)
{
desination.Title = nameElement.Value;
}
childList.Add(desination);
}
}
return childList;
}
示例2: AnnualPolicy
public AnnualPolicy(Age age, Sex gender, Destination destination, Tax tax)
{
this.age = age;
this.gender = gender;
this.destination = destination;
this.tax = tax;
}
示例3: ShouldBeAbleToMapNullableNullToItsNotNullable
public void ShouldBeAbleToMapNullableNullToItsNotNullable()
{
Mapper.CreateMap<Destination, Source>();
var source = new Destination();
Source destination = Mapper.Map<Destination, Source>(source);
Assert.Equal(0, destination.Property);
}
示例4: Write_navigation_for_a_destination
public void Write_navigation_for_a_destination()
{
const string parentAtlasId = "3";
const string parentTitle = "ParentDestination";
const string childAtlasId1 = "4";
const string childTitle1 = "ChildDestination1";
const string childAtlasId2 = "5";
const string childTitle2 = "ChildDestination2";
var destination = new Destination
{
AssetId = "1",
AtlasId = "2",
Title = "title",
TitleAscii = "title2",
IntroductionOverview = "Intro"
};
var taxonomyParser = Substitute.For<ITaxonomyParser>();
taxonomyParser.GetParent(destination.AtlasId).Returns(new Destination { AtlasId = parentAtlasId, Title = parentTitle});
taxonomyParser.GetChildren(destination.AtlasId).Returns(new List<Destination> { new Destination { AtlasId = childAtlasId1, Title = childTitle1 }, new Destination { AtlasId = childAtlasId2, Title = childTitle2 } });
var templateLoader = Substitute.For<ITemplateLoader>();
var writer = new HTMLFileWriter(templateLoader, taxonomyParser);
var navHTML = writer.GetNavigation(destination.AtlasId);
Assert.That(navHTML, Is
.StringContaining(@"<ul><li><a href=""./" + parentAtlasId + @".html"">" + parentTitle + "</a></li></ul>")
.And.ContainsSubstring(@"<ul><li><a href=""./" + childAtlasId1 + @".html"">" + childTitle1 + @"</a></li><li><a href=""./" + childAtlasId2 + @".html"">" + childTitle2 + "</a></li></ul>"));
}
示例5: Because_of
protected override void Because_of()
{
var source = new Source
{
};
_destination = Mapper.Map<Source, Destination>(source);
}
示例6: Populate_a_template_file_with_info_from_a_destination
public void Populate_a_template_file_with_info_from_a_destination()
{
var destination = new Destination
{
AssetId = "1",
AtlasId = "2",
Title = "title",
TitleAscii = "title2",
IntroductionOverview = "Intro"
};
var template = File.ReadAllText("Resources/template_file.txt");
var templateLoader = Substitute.For<ITemplateLoader>();
templateLoader.Template.Returns(template);
var taxonomyParser = Substitute.For<ITaxonomyParser>();
taxonomyParser.GetParent(Arg.Any<string>()).Returns(new Destination());
taxonomyParser.GetChildren(Arg.Any<string>()).Returns(new List<Destination>());
var writer = new HTMLFileWriter(templateLoader, taxonomyParser);
var output = writer.Generate(destination);
Assert.That(output, Is
.StringContaining("<h1>Lonely Planet: title</h1>")
.And.ContainsSubstring(@"<div class=""inner"">Intro</div>")
.And.Not.ContainsSubstring("{NAVIGATION}"));
var assert = templateLoader.Received().Template;
}
示例7: LocationURL
private static string LocationURL(Destination which)
{
if (formatLocationURL == null)
{
// look for "OverrideUpdateLocation" registry entry. This allows for testing a new release (in a temp location)
// before making the new release public.
using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(Program.RegistryRootPath, false))
{
object obj = regKey.GetValue("OverrideUpdateLocation");
if (obj != null && (obj is string))
{
formatLocationURL = (string)obj;
}
}
if (string.IsNullOrEmpty(formatLocationURL))
{
formatLocationURL = DefaultUpdateURLRoot;
}
}
string url = string.Format(formatLocationURL, hostname);
return url;
}
示例8: GetParent
public Destination GetParent(string atlasId)
{
_stream.Seek(0, 0);
var element = XElement.Load(_stream);
var targetElement = element.Descendants("node").FirstOrDefault(n => n.Attribute("atlas_node_id") != null && n.Attribute("atlas_node_id").Value == atlasId);
var returnDestination = new Destination();
if (targetElement != null)
{
if (targetElement.Parent != null)
{
var parentAltasIDAttribute = targetElement.Parent.Attribute("atlas_node_id");
if (parentAltasIDAttribute != null)
{
returnDestination.AtlasId = parentAltasIDAttribute.Value;
}
var parentNameElement = targetElement.Parent.Element("node_name");
if (parentNameElement != null)
{
returnDestination.Title = parentNameElement.Value;
}
return returnDestination;
}
}
return null;
}
示例9: Should_dynamically_map_the_two_types
public void Should_dynamically_map_the_two_types()
{
_resultWithGenerics = Mapper.Map<Source, Destination>(new Source {Value = 5});
_resultWithoutGenerics = (Destination) Mapper.Map(new Source {Value = 5}, typeof(Source), typeof(Destination));
_resultWithGenerics.Value.ShouldEqual(5);
_resultWithoutGenerics.Value.ShouldEqual(5);
}
示例10: SingleTripPolicy
public SingleTripPolicy(Age age, Sex gender, Destination destination, PeriodOfTravel duration, Tax tax)
{
this.age = age;
this.gender = gender;
this.destination = destination;
this.duration = duration;
this.tax = tax;
}
示例11: create_map
protected override void create_map()
{
MicroMapper.CreateMap<Source, Destination>();
MicroMapper.Init();
_source = new Source() { Value1 = 4, Value2 = "hello" };
_destination = MicroMapper.Map<Source, Destination>(_source);
}
示例12: Because_of
protected override void Because_of()
{
var dest = new Destination
{
Value = 10
};
_source = Mapper.Map<Destination, Source>(dest);
}
示例13: AddCodeSpan
internal void AddCodeSpan( Destination dest, LexSpan span ) {
if (!span.IsInitialized) return;
switch (dest) {
case Destination.codeIncl: CodeIncl.Add( span ); break;
case Destination.scanProlog: Prolog.Add( span ); break;
case Destination.scanEpilog: Epilog.Add( span ); break;
}
}
示例14: Edit
public void Edit(string name, decimal cost, List<Question> questions, Color color, Destination sendTo)
{
this.name = name;
this.cost = cost;
this.color = color;
this.questions = questions;
this.sendTo = sendTo;
}
示例15: Because_of
protected override void Because_of()
{
_destination = new Destination
{
ArrayOfItems = new string[] { "Red Fish", "Blue Fish" },
};
Mapper.Map(new Source(), _destination);
}