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; }
public AnnualPolicy(Age age, Sex gender, Destination destination, Tax tax) { this.age = age; this.gender = gender; this.destination = destination; this.tax = tax; }
protected override void Because_of() { var source = new Source { }; _destination = Mapper.Map<Source, Destination>(source); }
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; }
public void ShouldBeAbleToMapNullableNullToItsNotNullable() { Mapper.CreateMap<Destination, Source>(); var source = new Destination(); Source destination = Mapper.Map<Destination, Source>(source); Assert.Equal(0, destination.Property); }
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; }
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); }
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>")); }
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; }
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; } }
protected override void Because_of() { var dest = new Destination { Value = 10 }; _source = Mapper.Map<Destination, Source>(dest); }
protected override void create_map() { MicroMapper.CreateMap<Source, Destination>(); MicroMapper.Init(); _source = new Source() { Value1 = 4, Value2 = "hello" }; _destination = MicroMapper.Map<Source, Destination>(_source); }
protected override void Because_of() { _destination = new Destination { ArrayOfItems = new string[] { "Red Fish", "Blue Fish" }, }; Mapper.Map(new Source(), _destination); }
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; }
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; }
public void Should_call_ctor_once() { var source = new Source {Value = 5}; var dest = new Destination {Value = 7}; Mapper.Map(source, dest, opt => opt.CreateMissingTypeMaps = true); Destination.CallCount.ShouldEqual(1); }
protected override void Because_of() { var source = new Source { Values = new[] {1, 2, 3, 4}, Values2 = new[] {5, 6}, }; _destination = Mapper.Map<Source, Destination>(source); }
public WindowsService() { InitializeComponent(); var source = new Source(); var destination = new Destination(ConfigurationManager.AppSettings["ArbServiceBaseAddress"]); var log = new Log(); var integrator = new Integrator(source, destination, log); _scheduler = new IntegratorScheduler(integrator); }
protected override void Because_of() { _source = new Source { Value = 10, }; _originalDest = new Destination { Value = 1111 }; _dest = Mapper.Map<Source, Destination>(_source, _originalDest); }
public Item(string name, decimal cost, List<Question> questions, Color color, int buttonPos, Destination sendTo) { this.name = name; this.cost = cost; this.color = color; this.questions = questions; this.buttonPosition = buttonPos; this.sendTo = sendTo; }
public void BindingWithExpressionsOneWayToSourceWorks() { var source = new Source(); var destination = new Destination(); var engine = new BindingEngine<Destination, Source>(destination, source) .Bind(d => d.DestinationData, s => s.Data, BindingType.OneWayToSource); destination.DestinationData = 5; Assert.AreEqual(5, source.Data); }
public void BindingWithPropertyNameOneWayToSourceWorks() { var source = new Source(); var destination = new Destination(); var engine = new BindingEngine(destination, source) .Bind("DestinationData", "Data", BindingType.OneWayToSource); destination.DestinationData = 5; Assert.AreEqual(5, source.Data); }
public void Should_call_ctor_once() { var source = new Source {Value = 5}; var dest = new Destination {Value = 7}; var config = new MapperConfiguration(cfg => cfg.CreateMissingTypeMaps = true); config.CreateMapper().Map(source, dest); Destination.CallCount.ShouldEqual(1); }
public override void Alu(ALU a, Destination d, R32 r, R32 b, byte imm8) { if (d == Destination.R) { @out.WriteLine("{0} {1},dword ptr [{2}+{3:X}h]", a.ToString().ToLower(), r, b, imm8); } else { @out.WriteLine("{0} dword ptr [{1}+{2:X}h],{3}", a.ToString().ToLower(), b, imm8, r); } }
public void TestCase() { var source = new Source() { Name = "Test" }; var destination = new Destination(); MicroMapper.Mapper.Map<Source, Destination>(source, destination); // Works var subDestination = new SubDestination(); MicroMapper.Mapper.Map<Source, Destination>(source, subDestination); // Fails }
protected override void Because_of() { _source = Mapper.Map<Destination, Source>(new Destination { UserId = SomeId }); _destination = Mapper.Map<Source, Destination>(new Source { AccountId = SomeOtherId }); }
protected override void Because_of() { var source = new Source { Value = 5, Child = new ChildSource { Value2 = "foo" } }; _resultWithGenerics = Mapper.DynamicMap<Source, Destination>(source); }
static void Main() { //string file = RWFiles.OpenFile(); //Console.Write(file); //Console.WriteLine(); //Console.ReadLine(); Destination destinatin1 = new Destination(""); int test = destinatin1.Index<int>("359802203944"); Console.WriteLine("Index: {0}", test); Console.ReadLine(); }
public When_mapping_two_non_configured_types_with_nesting() { var source = new Source { Value = 5, Child = new ChildSource { Value2 = "foo" } }; _resultWithGenerics = Mapper.Map<Source, Destination>(source); }
private void AddCheckBox(Panel panel, Destination destination, string text) { CheckBox checkbox = new CheckBox(); checkbox.Text = text; //checkbox.Width = 200; //checkbox.Height = 20; checkbox.AutoSize = true; if (config.OutputDestinations.Contains(destination)) { checkbox.Checked = true; } panel.Controls.Add(checkbox); }
private void detach_Destination(Destination entity) { this.SendPropertyChanging(); entity.Sights = null; }
internal void SetDestination(Destination value) { _destination = value; }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MedicationDispense; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>)StatusElement.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Dispenser != null) { dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)Dispenser.DeepCopy(); } if (AuthorizingPrescription != null) { dest.AuthorizingPrescription = new List <Hl7.Fhir.Model.ResourceReference>(AuthorizingPrescription.DeepCopy()); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Quantity != null) { dest.Quantity = (Hl7.Fhir.Model.SimpleQuantity)Quantity.DeepCopy(); } if (DaysSupply != null) { dest.DaysSupply = (Hl7.Fhir.Model.SimpleQuantity)DaysSupply.DeepCopy(); } if (Medication != null) { dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy(); } if (WhenPreparedElement != null) { dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopy(); } if (WhenHandedOverElement != null) { dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopy(); } if (Destination != null) { dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopy(); } if (Receiver != null) { dest.Receiver = new List <Hl7.Fhir.Model.ResourceReference>(Receiver.DeepCopy()); } if (NoteElement != null) { dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy(); } if (DosageInstruction != null) { dest.DosageInstruction = new List <Hl7.Fhir.Model.MedicationDispense.DosageInstructionComponent>(DosageInstruction.DeepCopy()); } if (Substitution != null) { dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)Substitution.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public int CreateDestination(Destination destionation) { _db.Destinations.Add(destionation); _db.SaveChanges(); return(destionation.Id); }
public override void Invoke(AMFContext context) { MessageOutput messageOutput = context.MessageOutput; for (int i = 0; i < context.AMFMessage.BodyCount; i++) { AMFBody amfBody = context.AMFMessage.GetBodyAt(i); ResponseBody responseBody = null; //Check for Flex2 messages and skip if (amfBody.IsEmptyTarget) { continue; } //Check if response exists. responseBody = messageOutput.GetResponse(amfBody); if (responseBody != null) { continue; } try { MessageBroker messageBroker = _endpoint.GetMessageBroker(); RemotingService remotingService = messageBroker.GetService(RemotingService.RemotingServiceId) as RemotingService; if (remotingService == null) { string serviceNotFound = __Res.GetString(__Res.Service_NotFound, RemotingService.RemotingServiceId); responseBody = new ErrorResponseBody(amfBody, new AMFException(serviceNotFound)); messageOutput.AddBody(responseBody); continue; } Destination destination = null; if (destination == null) { destination = remotingService.GetDestinationWithSource(amfBody.TypeName); } if (destination == null) { destination = remotingService.DefaultDestination; } //At this moment we got a destination with the exact source or we have a default destination with the "*" source. if (destination == null) { string destinationNotFound = __Res.GetString(__Res.Destination_NotFound, amfBody.TypeName); responseBody = new ErrorResponseBody(amfBody, new AMFException(destinationNotFound)); messageOutput.AddBody(responseBody); continue; } //Cache check string source = amfBody.TypeName + "." + amfBody.Method; IList parameterList = amfBody.GetParameterList(); FactoryInstance factoryInstance = destination.GetFactoryInstance(); factoryInstance.Source = amfBody.TypeName; object instance = factoryInstance.Lookup(); if (instance != null) { bool isAccessible = TypeHelper.GetTypeIsAccessible(instance.GetType()); if (!isAccessible) { string msg = __Res.GetString(__Res.Type_InitError, amfBody.TypeName); responseBody = new ErrorResponseBody(amfBody, new AMFException(msg)); messageOutput.AddBody(responseBody); continue; } MethodInfo mi = null; if (!amfBody.IsRecordsetDelivery) { mi = MethodHandler.GetMethod(instance.GetType(), amfBody.Method, amfBody.GetParameterList()); } else { //will receive recordsetid only (ignore) mi = instance.GetType().GetMethod(amfBody.Method); } if (mi != null) { #region Invocation handling ParameterInfo[] parameterInfos = mi.GetParameters(); //Try to handle missing/optional parameters. object[] args = new object[parameterInfos.Length]; if (!amfBody.IsRecordsetDelivery) { if (args.Length != parameterList.Count) { string msg = __Res.GetString(__Res.Arg_Mismatch, parameterList.Count, mi.Name, args.Length); responseBody = new ErrorResponseBody(amfBody, new ArgumentException(msg)); messageOutput.AddBody(responseBody); continue; } parameterList.CopyTo(args, 0); } else { if (amfBody.Target.EndsWith(".release")) { responseBody = new ResponseBody(amfBody, null); messageOutput.AddBody(responseBody); continue; } string recordsetId = parameterList[0] as string; string recordetDeliveryParameters = amfBody.GetRecordsetArgs(); byte[] buffer = System.Convert.FromBase64String(recordetDeliveryParameters); recordetDeliveryParameters = System.Text.Encoding.UTF8.GetString(buffer); if (recordetDeliveryParameters != null && recordetDeliveryParameters != string.Empty) { string[] stringParameters = recordetDeliveryParameters.Split(new char[] { ',' }); for (int j = 0; j < stringParameters.Length; j++) { if (stringParameters[j] == string.Empty) { args[j] = null; } else { args[j] = stringParameters[j]; } } //TypeHelper.NarrowValues(argsStore, parameterInfos); } } TypeHelper.NarrowValues(args, parameterInfos); try { InvocationHandler invocationHandler = new InvocationHandler(mi); object result = invocationHandler.Invoke(instance, args); responseBody = new ResponseBody(amfBody, result); } catch (UnauthorizedAccessException exception) { responseBody = new ErrorResponseBody(amfBody, exception); } catch (Exception exception) { if (exception is TargetInvocationException && exception.InnerException != null) { responseBody = new ErrorResponseBody(amfBody, exception.InnerException); } else { responseBody = new ErrorResponseBody(amfBody, exception); } } #endregion Invocation handling } else { responseBody = new ErrorResponseBody(amfBody, new MissingMethodException(amfBody.TypeName, amfBody.Method)); } } else { responseBody = new ErrorResponseBody(amfBody, new TypeInitializationException(amfBody.TypeName, null)); } } catch (Exception exception) { responseBody = new ErrorResponseBody(amfBody, exception); } messageOutput.AddBody(responseBody); } }
public int GetHashCode(Destination obj) => HashCode.Combine(obj.Target, obj.FnSignature);
protected override void Because_of() { Source source = new Source(); _destination = Mapper.Map <Source, Destination>(source); }
private NoticeSendResult SendMessage(NotifyMessage m) { //Check if we need to query stats RefreshQuotaIfNeeded(); if (quota != null) { lock (locker) { if (quota.Max24HourSend <= quota.SentLast24Hours) { //Quota exceeded, queue next refresh to +24 hours lastRefresh = DateTime.UtcNow.AddHours(24); Log.WarnFormat("Quota limit reached. setting next check to: {0}", lastRefresh); return(NoticeSendResult.SendingImpossible); } } } var dest = new Destination { ToAddresses = m.To.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(a => MailAddressUtils.Create(a).Address).ToList(), }; var subject = new Content(MimeHeaderUtils.EncodeMime(m.Subject)) { Charset = Encoding.UTF8.WebName, }; Body body; if (m.ContentType == Pattern.HTMLContentType) { body = new Body(new Content(HtmlUtil.GetText(m.Content)) { Charset = Encoding.UTF8.WebName }) { Html = new Content(GetHtmlView(m.Content)) { Charset = Encoding.UTF8.WebName } }; } else { body = new Body(new Content(m.Content) { Charset = Encoding.UTF8.WebName }); } var from = MailAddressUtils.Create(m.From).ToEncodedString(); var request = new SendEmailRequest { Source = from, Destination = dest, Message = new Message(subject, body) }; if (!string.IsNullOrEmpty(m.ReplyTo)) { request.ReplyToAddresses.Add(MailAddressUtils.Create(m.ReplyTo).Address); } ThrottleIfNeeded(); var response = ses.SendEmailAsync(request).Result; lastSend = DateTime.UtcNow; return(response != null ? NoticeSendResult.OK : NoticeSendResult.TryOnceAgain); }
public bool Equals(Destination x, Destination y) => Equals(x.Target, y.Target) && Equals(x.FnSignature, y.FnSignature);
public Vector3 GetTargetPointFromDestination(Destination dest) { return(destPoints[(int)dest]); }
public static void SendEmail(string fromEmailAddress, string fromFriendlyName, string toEmailAddress, string emailSubject, string emailBody) { /* * * var client = new AmazonSimpleEmailServiceClient(Settings.Default.AWSAccessKey, * Settings.Default.AWSSecretKey, * Amazon.RegionEndpoint.EUWest1); * * var client = new AmazonSimpleEmailServiceClient("AKIAIJINFUWK57TVYABQ", * "AosdbK3YfN8zvFltHNDuxFZrHVZNlLeBZQ1pGKG8dFCd", * Amazon.RegionEndpoint.EUWest1); */ /* * var destination = new Destination(new List<string>() {toEmailAddress}); * var subjectContent = new Content(subject); * var bodyContent = new Content(body); * var messageBody = new Body(bodyContent); * var message = new Message(subjectContent, messageBody); * * var request = new SendEmailRequest(fromEmailAddress, destination, message); * * client.SendEmail(request); */ String FROM = fromEmailAddress; // Replace with your "From" address. This address must be verified. String TO = toEmailAddress; // Replace with a "To" address. If you have not yet requested // production access, this address must be verified. const String SUBJECT = "Amazon SES test (AWS SDK for .NET)"; const String BODY = "This email was sent through Amazon SES by using the AWS SDK for .NET."; // Construct an object to contain the recipient address. Destination destination = new Destination(); destination.ToAddresses = (new List <string>() { TO }); // Create the subject and body of the message. Content subject = new Content(SUBJECT); Content textBody = new Content(BODY); Body body = new Body(textBody); // Create a message with the specified subject and body. Message message = new Message(subject, body); // Assemble the email. SendEmailRequest request = new SendEmailRequest(FROM, destination, message); // Choose the AWS region of the Amazon SES endpoint you want to connect to. Note that your production // access status, sending limits, and Amazon SES identity-related settings are specific to a given // AWS region, so be sure to select an AWS region in which you set up Amazon SES. Here, we are using // the US East (N. Virginia) region. Examples of other regions that Amazon SES supports are USWest2 // and EUWest1. For a complete list, see http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html Amazon.RegionEndpoint REGION = Amazon.RegionEndpoint.EUWest1; // Instantiate an Amazon SES client, which will make the service call. var client = new AmazonSimpleEmailServiceClient(Settings.Default.AWSAccessKey, Settings.Default.AWSSecretKey, Amazon.RegionEndpoint.EUWest1); // Send the email. // client.VerifyEmailAddress(new VerifyEmailAddressRequest() {EmailAddress = fromEmailAddress}); client.SendEmail(request); Console.WriteLine("Email sent!"); }
protected override void Because_of() { _destination = Mapper.Map <Destination>(new Source { Value1 = decimal.MaxValue }); }
public override string ToString() { return(Source.ToString() + " ---[" + Description + "]---> " + Destination.ToString()); }
protected override void Because_of() { _result = Mapper.Map <Source, Destination>(new Source(10)); }
public IActionResult DisplayLocationWithAjax(string city, string country, int id) { Destination newDestination = new Destination(city, country, id); return(View(newDestination)); }
public csMsgProducer(String[] args) { ParseArgs(args); #if _NET_20 try { tibemsUtilities.initSSLParams(serverUrl, args); } catch (Exception e) { System.Console.WriteLine("Exception: " + e.Message); System.Console.WriteLine(e.StackTrace); System.Environment.Exit(-1); } #endif Console.WriteLine("\n------------------------------------------------------------------------"); Console.WriteLine("csMsgProducer SAMPLE"); Console.WriteLine("------------------------------------------------------------------------"); Console.WriteLine("Server....................... " + ((serverUrl != null)?serverUrl:"localhost")); Console.WriteLine("User......................... " + ((userName != null)?userName:"******")); Console.WriteLine("Destination.................. " + name); Console.WriteLine("Message Text................. "); for (int i = 0; i < data.Count; i++) { Console.WriteLine(data[i]); } Console.WriteLine("------------------------------------------------------------------------\n"); try { BytesMessage msg; int i; if (data.Count == 0) { Console.Error.WriteLine("Error: must specify at least one message text\n"); Usage(); } Console.WriteLine("Publishing to destination '" + name + "'\n"); ConnectionFactory factory = new TIBCO.EMS.ConnectionFactory(serverUrl); connection = factory.CreateConnection(userName, password); // create the session session = connection.CreateSession(false, Session.AUTO_ACKNOWLEDGE); // create the destination if (useTopic) { destination = session.CreateTopic(name); } else { destination = session.CreateQueue(name); } // create the producer msgProducer = session.CreateProducer(null); // publish messages for (i = 0; i < data.Count; i++) { // create text message //msg = session.CreateTextMessage(); msg = session.CreateBytesMessage(); // set message text //msg.Text = (String) data[i]; msg.WriteBoolean(false); msg.WriteChar('a'); msg.WriteShort(289); msg.WriteInt(System.Int32.MinValue); msg.WriteLong(10000111121); msg.WriteFloat((float)-2.23); msg.WriteDouble(-1.2345678); // publish message msgProducer.Send(destination, msg); Console.WriteLine("Published message: " + data[i]); } // close the connection connection.Close(); } catch (EMSException e) { Console.Error.WriteLine("Exception in csMsgProducer: " + e.Message); Console.Error.WriteLine(e.StackTrace); Environment.Exit(-1); } }
public abstract void received(UDTPacket packet, Destination peer);
protected override void Because_of() { _destination = Mapper.Map <Destination>(new Source { Values = new Dictionary <int, int>() }); }
public FlashMapperIgnoreTestParticipant() { mappingConfiguration = new MappingConfiguration(); destination = new Destination(); }
// Start is called before the first frame update void Start() { actionOnArrival = null; destination = null; animator = GetComponent <Animator>(); }
public override string ToString() { return("ReadWriteComplex. Source member:" + Source + " Target member:" + Destination.ToString()); }
protected override void Because_of() { _destination = Mapper.Map <Source, Destination>(new Source { Value = 4 }); }
public RunPacket(byte serialNum, ushort agvId, MoveDirection direction, ushort speed, Destination location) { this.Header = 0xAA55; this.Len = NeedLen(); this.SerialNum = serialNum; this.Type = (byte)PacketType.Run; this.AgvId = agvId; this.Direction = direction; this.Speed = speed; this.Locations = location; }
public CountryViewModel(Window wnd, Destination destination) { this.wnd = wnd; this.dest = destination; Init(); }
/// <summary> /// Gets available shipping options /// </summary> /// <param name="getShippingOptionRequest">A request for getting shipping options</param> /// <returns>Represents a response of getting shipping rate options</returns> public GetShippingOptionResponse GetShippingOptions(GetShippingOptionRequest getShippingOptionRequest) { if (getShippingOptionRequest == null) { throw new ArgumentNullException("getShippingOptionRequest"); } var response = new GetShippingOptionResponse(); if (getShippingOptionRequest.Items == null) { response.AddError("No shipment items"); return(response); } if (getShippingOptionRequest.ShippingAddress == null) { response.AddError("Shipping address is not set"); return(response); } if (getShippingOptionRequest.ShippingAddress.Country == null) { response.AddError("Shipping country is not set"); return(response); } if (getShippingOptionRequest.ShippingAddress.StateProvince == null) { response.AddError("Shipping state is not set"); return(response); } try { var profile = new Profile(); profile.MerchantId = _canadaPostSettings.CustomerId; var destination = new Destination(); destination.City = getShippingOptionRequest.ShippingAddress.City; destination.StateOrProvince = getShippingOptionRequest.ShippingAddress.StateProvince.Abbreviation; destination.Country = getShippingOptionRequest.ShippingAddress.Country.TwoLetterIsoCode; destination.PostalCode = getShippingOptionRequest.ShippingAddress.ZipPostalCode; var items = CreateItems(getShippingOptionRequest); var lang = CanadaPostLanguageEnum.English; if (_workContext.WorkingLanguage.LanguageCulture.StartsWith("fr", StringComparison.InvariantCultureIgnoreCase)) { lang = CanadaPostLanguageEnum.French; } var requestResult = GetShippingOptionsInternal(profile, destination, items, lang); if (requestResult.IsError) { response.AddError(requestResult.StatusMessage); } else { foreach (var dr in requestResult.AvailableRates) { var so = new ShippingOption(); so.Name = dr.Name; if (!string.IsNullOrEmpty(dr.DeliveryDate)) { so.Name += string.Format(" - {0}", dr.DeliveryDate); } so.Rate = dr.Amount; response.ShippingOptions.Add(so); } } foreach (var shippingOption in response.ShippingOptions) { if (!shippingOption.Name.StartsWith("canada post", StringComparison.InvariantCultureIgnoreCase)) { shippingOption.Name = string.Format("Canada Post {0}", shippingOption.Name); } } } catch (Exception e) { response.AddError(e.Message); } return(response); }
public void BasicTest() { using (StoreContext storeContext = new StoreContext()) { Assert.AreEqual(0, storeContext.PayloadRecords.Count()); Assert.AreEqual(0, storeContext.Destinations.Count()); Destination destination = new Destination() { AccessToken = "token1", Endpoint = "http://endpoint.com" }; Assert.AreNotEqual(Guid.Empty, destination.ID); destination.PayloadRecords.Add(new PayloadRecord() { PayloadJson = "payload1", Timestamp = DateTime.UtcNow, }); storeContext.Add(destination); storeContext.SaveChanges(); } using (StoreContext storeContext = new StoreContext()) { Assert.AreEqual(1, storeContext.Destinations.Count()); Assert.AreEqual(1, storeContext.PayloadRecords.Count()); } using (StoreContext storeContext = new StoreContext()) { Destination destination = storeContext.Destinations.FirstOrDefault(d => d.AccessToken == "token1"); Assert.IsNotNull(destination); Assert.AreEqual("token1", destination.AccessToken); PayloadRecord payloadRecord = null; payloadRecord = new PayloadRecord() { PayloadJson = "payload2", Timestamp = DateTime.UtcNow, }; storeContext.Entry(payloadRecord).State = EntityState.Added; destination.PayloadRecords.Add(payloadRecord); payloadRecord = new PayloadRecord() { PayloadJson = "payload3", Timestamp = DateTime.UtcNow, Destination = destination }; destination.PayloadRecords.Add(payloadRecord); storeContext.Add(payloadRecord); payloadRecord = new PayloadRecord() { PayloadJson = "payload4", Timestamp = DateTime.UtcNow, Destination = destination }; destination.PayloadRecords.Add(payloadRecord); storeContext.PayloadRecords.Add(payloadRecord); destination = new Destination() { AccessToken = "token2", Endpoint = "http://endpoint.com" }; Assert.AreNotEqual(Guid.Empty, destination.ID); storeContext.Entry(destination).State = EntityState.Added; payloadRecord = new PayloadRecord() { PayloadJson = "payload5", Timestamp = DateTime.UtcNow, }; storeContext.Entry(payloadRecord).State = EntityState.Added; destination.PayloadRecords.Add(payloadRecord); payloadRecord = new PayloadRecord() { PayloadJson = "payload6", Timestamp = DateTime.UtcNow, Destination = destination }; storeContext.Entry(payloadRecord).State = EntityState.Added; storeContext.Add(payloadRecord); payloadRecord = new PayloadRecord() { PayloadJson = "payload7", Timestamp = DateTime.UtcNow, Destination = destination }; storeContext.Entry(payloadRecord).State = EntityState.Added; storeContext.PayloadRecords.Add(payloadRecord); storeContext.Add(destination); storeContext.SaveChanges(); } using (StoreContext storeContext = new StoreContext()) { Assert.AreEqual(2, storeContext.Destinations.Count()); Assert.AreEqual(7, storeContext.PayloadRecords.Count()); Assert.AreEqual(4, storeContext.Destinations .Where(d => d.AccessToken == "token1") .Include(d => d.PayloadRecords) .First() .PayloadRecords .Count ); Assert.AreEqual(3, storeContext.Destinations .Where(d => d.AccessToken == "token2") .Include(d => d.PayloadRecords) .First() .PayloadRecords .Count ); } }
partial void DeleteDestination(Destination instance);
public int Resolve(Source source, Destination destination, int destMember, ResolutionContext context) { return(1000); }
protected override void Because_of() { _destination = Mapper.Map <Destination>(new Source { Items = _items }); }
public async Task <Destination> GetOneDestination(string id) { Destination destination = await _service.GetDestination(id); return(destination); }