/// <summary> /// Constructor. /// </summary> /// <param name="departureLocation">Location of departure.</param> /// <param name="arrivalLocation">Location of arrival.</param> /// <param name="departureTime">Time of departure.</param> /// <param name="arrivalTime">Time of arrival.</param> public CarrierMovement(Location.Location departureLocation, Location.Location arrivalLocation, DateTime departureTime, DateTime arrivalTime) { if (departureLocation == null) { throw new ArgumentNullException("departureLocation"); } if (arrivalLocation == null) { throw new ArgumentNullException("arrivalLocation"); } if (departureTime == default(DateTime)) { throw new ArgumentException("departureTime is not initialized"); } if (arrivalTime == default(DateTime)) { throw new ArgumentException("arrivalTime is not initialized"); } _departureLocation = departureLocation; _arrivalLocation = arrivalLocation; _departureTime = departureTime; _arrivalTime = arrivalTime; }
/// <summary> /// Creates new leg instance. /// </summary> /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param> /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param> /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param> /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param> public Leg(Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate) { _loadLocation = loadLocation; _unloadDate = unloadDate; _unloadLocation = unloadLocation; _loadDate = loadDate; }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate, this); _events.Add(@event); DomainEvents.Raise(new CargoWasHandledEvent(@event)); }
public void Reposition(Location.Location location, Direction direction) { DownStream = Direction.Invert(); Location = location; Direction = direction; }
public void HandleLandOnLocation(Location.Location location, Player currentPlayer) { if (!location.Purchased) { return; } if (location.Owner == currentPlayer) { return; } if (DoesOwnerHaveMonopoly(location)) { currentPlayer.Money -= location.TitleDeed.Monopoly; location.Owner.Money += location.TitleDeed.Monopoly; Console.WriteLine(location.Owner + " has MONOPOLY!"); Console.WriteLine(currentPlayer.Token + " owes " + location.Owner.Token + " £" + location.TitleDeed.Monopoly); return; } currentPlayer.Money -= location.TitleDeed.Rent; location.Owner.Money += location.TitleDeed.Rent; Console.WriteLine(currentPlayer.Token + " owes " + location.Owner.Token + " £" + location.TitleDeed.Rent); }
public List <LocationInputModel> GetLocations(int previousSortOrder) { var userId = new Guid("C49200FC-C271-4CC3-8905-086A2CE9AB4E"); var location = new Location.Location(Settings); return(Mapper.Map <List <LocationInputModel> >(location.GetLocationsByUserId(userId, previousSortOrder))); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, HandlingHistory parent) { _eventType = eventType; _parent = parent; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; }
/// <summary> /// Creates new leg instance. /// </summary> /// <param name="voyage">Voyage</param> /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param> /// <param name="loadDate">Date and time when cargo is supposed to be loaded</param> /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param> /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param> public Leg(Voyage.Voyage voyage, Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate) { _loadLocation = loadLocation; _voyage = voyage; _unloadDate = unloadDate; _unloadLocation = unloadLocation; _loadDate = loadDate; }
/// <summary> /// Creates an instance of <see cref="HandlingActivity"/> from the handling event type and the location. /// </summary> /// <param name="eventType">The handling event type.</param> /// <param name="location">The location where the handling is done.</param> public HandlingActivity(HandlingEventType eventType, Location.Location location) { if (location == null) throw new ArgumentNullException("location"); _eventType = eventType; _location = location; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; }
public void CpuPostRoll(Location.Location location, Player player) { if (player.Money > location.TitleDeed.Cost) { PurchaseLocation(location, player); Console.WriteLine("[CPU]" + player.Token + " brought " + location.Name); } }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, HandlingHistory parent) { EventType = eventType; HandlingHistory = parent; CompletionDate = completionDate; RegistrationDate = registrationDate; Location = location; }
// TODO: return a more complex type public bool RemoveLocation(decimal longitude, decimal latitude) { var location = new Location.Location(Settings); location.Remove(longitude, latitude); return(true); }
internal static async Task ApplyLocation(this AdapterData adapter, Location.Location location) { if (location == null) { return; } bool result; if (location.DHCPEnabled) { await SetDHCP(adapter); return; } string[] IP = new string[location.IPList.Count]; string[] subNet = new string[location.IPList.Count]; for (byte b = 0; b < location.IPList.Count(); b++) { IP[b] = location.IPList[b].IP; subNet[b] = location.IPList[b].NetMask; } string[] gateWay = new string[location.Gateways.Count]; if (gateWay.Any()) { gateWay = new string[] { IP.FirstOrDefault() } } ; else { for (byte b = 0; b < location.Gateways.Count(); b++) { gateWay[b] = location.Gateways[b].IP; } } result = await adapter.SetIP(IP, subNet, gateWay); if (!result) { return; } string[] dns = new string[location.DNS.Count]; for (byte b = 0; b < location.DNS.Count(); b++) { dns[b] = location.DNS[b].IP; } if (!await adapter.SetDnsServers(new string[] { IP.FirstOrDefault() })) { return; } if (!await adapter.SetDnsServers(dns)) { return; } }
public HandlingActivity(HandlingEventType eventType, Location.Location location) { if (location == null) { throw new ArgumentNullException("location"); } _eventType = eventType; _location = location; }
public Settlement(string name, Location.Location location, Culture.Culture culture) { Name = name; Location = location; TechManager = new TechManager(culture.TechTree); Culture = culture; Stockpile = new Stockpile(); TodaysWeather = Location.GenerateWeather(); }
// TODO: return a more complex type public dynamic AddLocation(LocationInputModel model) { var address = Mapper.Map <Address>(model); var location = new Location.Location(Settings); location.Add(address); return(true); }
public void PurchaseLocation(Location.Location location, Player player) { if (location.Purchased) { return; } location.Purchased = true; player.Money -= location.TitleDeed.Cost; location.Owner = player; }
/// <summary> /// Registers new handling event into the history. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">Location where event occured.</param> /// <param name="registrationDate">Date when event was registered.</param> /// <param name="completionDate">Date when action represented by the event was completed.</param> public virtual void RegisterHandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate) { HandlingEvent @event = new HandlingEvent(eventType, location, registrationDate, completionDate, this); _handlingEvents.Add(@event); _lastHandlingEvent = @event; Delivery currentDelivery = Delivery.DerivedFrom(_routeSpecification, _itinerary, @event); DomainEvents.Raise(new CargoWasHandledEvent(this, currentDelivery, eventType)); }
public RouteSpecification(Location.Location origin, Location.Location destination, DateTime arrivalDeadline) { if (origin == null) throw new ArgumentNullException("origin"); if (destination == null) throw new ArgumentNullException("destination"); if (arrivalDeadline < DateTime.Now.AddDays(2)) throw new ArgumentException("arrivalDeadline should be greater than actual date by two days"); if (origin.Equals(destination)) throw new ArgumentException("Origin and destination can't be the same: " + origin.Name); _origin = origin; _destination = destination; _arrivalDeadline = arrivalDeadline; }
public static DragonX CreateBlack(Location.Location initialLocation, GameEngine gameEngine) { var blackDragon = new DragonX(PlayerColor.Black, initialLocation, Direction.West, gameEngine); blackDragon.CreateAction().TurnRight().Execute(); blackDragon.CreateAction().TurnRight().Execute(); blackDragon.CreateAction().TurnRight().Execute(); blackDragon.CreateAction().TurnRight().Execute(); return(blackDragon); }
/// <summary> /// Creates an instance of <see cref="HandlingActivity"/> from the handling event type and the location. /// </summary> /// <param name="eventType">The handling event type.</param> /// <param name="location">The location where the handling is done.</param> /// <param name="voyage"></param> public HandlingActivity(HandlingEventType eventType, Location.Location location, Voyage.Voyage voyage) { if (location == null) throw new ArgumentNullException("location"); if (voyage == null) throw new ArgumentNullException("voyage"); _eventType = eventType; _location = location; _voyage = voyage; }
public static DragonX CreateWhite(Location.Location initialLocation, GameEngine gameEngine) { var whiteDragon = new DragonX(PlayerColor.White, initialLocation, Direction.South, gameEngine); whiteDragon.CreateAction().TurnLeft().Execute(); whiteDragon.CreateAction().TurnLeft().Execute(); whiteDragon.CreateAction().TurnLeft().Execute(); whiteDragon.CreateAction().TurnLeft().Execute(); return(whiteDragon); }
public void In(Location.Location location) { if (_expected) { Assert.IsTrue(_itinerary.IsExpected(Event(_eventType, location))); } else { Assert.IsFalse(_itinerary.IsExpected(Event(_eventType, location))); } }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; DomainEvents.Raise(new CargoWasHandledEvent(this)); }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType"></param> /// <param name="location"></param> /// <param name="registrationDate"></param> /// <param name="completionDate"></param> /// <param name="cargo"></param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo) { EventType = eventType; Location = location; RegistrationDate = registrationDate; CompletionDate = completionDate; Cargo = cargo; m_eventAggregator.Publish <CargoWasHandledEvent>(new CargoWasHandledEvent()); }
private DragonX(PlayerColor color, Location.Location initialLocation, Direction direction, GameEngine gameEngine) { Color = color; _consumedFire = Fire.Depleted; Head = new BodyPart(); Head.Reposition(initialLocation, direction); Tail = new Tail(); OnDragonHealed(new DragonHealthEventData(Tail, Color)); OnDragonConsumedFire(new DragonFireEventData(_consumedFire, Color)); _dragonActionFactory = new DragonActionFactory(this, gameEngine); }
protected ExpelElementAction(DragonX dragon, GameEngine game) : base(dragon, game) { _fullDamageLocation = Dragon.Location + Dragon.Direction; _partialDamageLocations = new[] { _fullDamageLocation + Dragon.Direction, _fullDamageLocation + Dragon.Direction.TurnLeft(), _fullDamageLocation + Dragon.Direction.TurnRight(), }; _noDistanceDamageLocation = _fullDamageLocation + Dragon.Direction + Dragon.Direction; }
private Delivery(HandlingEvent lastHandlingEvent, Itinerary itinerary, RouteSpecification specification) { _calculatedAt = DateTime.Now; _lastEvent = lastHandlingEvent; _isMisdirected = CalculateMisdirectionStatus(itinerary); _routingStatus = CalculateRoutingStatus(itinerary, specification); _transportStatus = CalculateTransportStatus(); _lastKnownLocation = CalculateLastKnownLocation(); _estimatedTimeOfArrival = CalculateEta(itinerary); _nextExpectedActivity = CalculateNextExpectedActivity(specification, itinerary); _isUnloadedAtDestination = CalculateUnloadedAtDestination(specification); }
/// <summary> /// Specifies a new route for this cargo. /// </summary> /// <param name="destination">New destination.</param> public virtual void SpecifyNewRoute(Location.Location destination) { if (destination == null) { throw new ArgumentNullException("destination"); } RouteSpecification routeSpecification = new RouteSpecification(_routeSpecification.Origin, destination, _routeSpecification.ArrivalDeadline); Delivery delivery = Delivery.DerivedFrom(routeSpecification, _itinerary, _lastHandlingEvent); CargoDestinationChangedEvent @event = new CargoDestinationChangedEvent(this, routeSpecification, _routeSpecification, delivery); _routeSpecification = routeSpecification; DomainEvents.Raise(@event); }
public void MoveTo(Location.Location location, Direction direction) { if (_segments.Length == 0) { return; } foreach (var segment in _segments) { var previousLocation = segment.Location; segment.Reposition(location, direction); location = previousLocation; } }
public WeatherModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude) { var location = new Location.Location(Settings); var currentWeather = location.GetCurrentWeatherByLocation(latitude, longitude); var model = new WeatherModel { CurrentTemperature = decimal.Round(currentWeather.Temperature, 1), UnitType = currentWeather.UnitType.ToString("g").Substring(0, 1).ToUpper(), WeatherQueryTime = currentWeather.WeatherQueryTime, }; return(model); }
public void MoveTo(Location.Location target, Direction direction) { Tail.MoveTo(Head.Location, direction); Head.Reposition(target, direction); if (MovedEventHandler != null) { MovedEventHandler(new DragonMovedEvent { Location = target, Direction = direction, Color = Color }); } }
/// <summary> /// Creates a new instance of <see cref="VoyageBuilder"/>. /// </summary> /// <param name="voyageNumber">Voyage number.</param> /// <param name="departureLocation">Departure location.</param> public VoyageBuilder(VoyageNumber voyageNumber, Location.Location departureLocation) { if (voyageNumber == null) { throw new ArgumentNullException("voyageNumber"); } if (departureLocation == null) { throw new ArgumentNullException("departureLocation"); } _voyageNumber = voyageNumber; _departureLocation = departureLocation; }
internal static Location.Location ExtractConfig(this AdapterData adapter, string NewName) { var location = new Location.Location { Description = AdapterDataLoc.NewLocationDescription, ID = Settings.Default.GetNextID() }; if (adapter.networkInterface == null) { return(location); } var properties = adapter.networkInterface.GetIPProperties(); // DHCP Enabled: location.DHCPEnabled = properties.GetIPv4Properties().IsDhcpEnabled; location.IPList.Clear(); foreach (var uniCast in properties.UnicastAddresses) { // Ignore loop-back addresses & IPv6 if (!IPAddress.IsLoopback(uniCast.Address) && uniCast.Address.AddressFamily != AddressFamily.InterNetworkV6 && uniCast.IPv4Mask != null) { var newIp = new IPDefinition { IP = uniCast.Address.ToString(), NetMask = uniCast.IPv4Mask.ToString() }; location.IPList.Add(newIp); } } foreach (var gateWay in properties.GatewayAddresses) { location.Gateways.Add(new IPv4Address { IP = gateWay.Address.ToString() }); } foreach (var dns in properties.DnsAddresses) { location.DNS.Add(new IPv4Address { IP = dns.ToString() }); } location.Description = NewName; return(location); }
public MainViewModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude) { var location = new Location.Location(Settings); var currentWeather = location.GetCurrentWeatherByLocation(latitude, longitude); var model = new MainViewModel { MainItems = new List<MainItemViewModel> { new MainItemViewModel{ CityName="Glendale, CA, USA", CurrentTemperature= decimal.Round(currentWeather.Temperature, 1), }, }, UnitType = currentWeather.UnitType.ToString("g").Substring(0, 1).ToUpper(), }; return model; }
/// <summary> /// Constructor. /// </summary> /// <param name="origin">Origin location - can't be the same as the destination.</param> /// <param name="destination">Destination location - can't be the same as the origin</param> /// <param name="arrivalDeadline">Arrival deadline.</param> public RouteSpecification(Location.Location origin, Location.Location destination, DateTime arrivalDeadline) { if (origin == null) throw new ArgumentNullException("origin"); if (destination == null) throw new ArgumentNullException("destination"); if (origin == destination) throw new ArgumentException("Origin and destination can't be the same."); if (arrivalDeadline == default(DateTime)) throw new ArgumentException("Arrival deadline is required.", "arrivalDeadline"); _origin = origin; _arrivalDeadline = arrivalDeadline; _destination = destination; }
/// <summary> /// Creates new leg instance. /// </summary> /// <param name="voyage"></param> /// <param name="loadLocation">Location where cargo is supposed to be loaded.</param> /// <param name="loadDate">Date and time when cargo is supposed to be loaded.</param> /// <param name="unloadLocation">Location where cargo is supposed to be unloaded.</param> /// <param name="unloadDate">Date and time when cargo is supposed to be unloaded.</param> public Leg(Voyage.Voyage voyage, Location.Location loadLocation, DateTime loadDate, Location.Location unloadLocation, DateTime unloadDate) { if (voyage == null) throw new ArgumentNullException("voyage", "The voyage cannot be null"); if (loadLocation == null) throw new ArgumentNullException("loadLocation", "The load location cannot be null"); if (unloadLocation == null) throw new ArgumentNullException("unloadLocation", "The unload location cannot be null"); if (loadDate == default(DateTime)) throw new ArgumentException("The load date is not correct.", "loadDate"); if (unloadDate == default(DateTime)) throw new ArgumentException("The unloadDate date is not correct.", "unloadDate"); _voyage = voyage; _loadLocation = loadLocation; _unloadDate = unloadDate; _unloadLocation = unloadLocation; _loadDate = loadDate; }
public RouteSpecification(Location.Location origin, Location.Location destination, DateTime arrivalDeadline) { if (origin == null) { throw new ArgumentNullException("origin"); } if (destination == null) { throw new ArgumentNullException("destination"); } if (origin == destination) { throw new ArgumentException("Origin and destination can't be the same."); } _origin = origin; _arrivalDeadline = arrivalDeadline; _destination = destination; }
/// <summary> /// Creates new event. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="location">The location where the event took place.</param> /// <param name="registrationDate">Registration time, the time the message is received.</param> /// <param name="completionDate">Completion time, the reported time that the event actually happened (e.g. the receive took place).</param> /// <param name="cargo">Cargo.</param> /// <param name="voyage">The voyage.</param> public HandlingEvent(HandlingEventType eventType, Location.Location location, DateTime registrationDate, DateTime completionDate, Cargo.Cargo cargo, Voyage.Voyage voyage) { if (cargo == null) throw new ArgumentNullException("cargo", "Cargo is required."); if (location == null) throw new ArgumentNullException("location", "Location is required."); if (voyage == null) throw new ArgumentNullException("voyage", "Voyage is required."); if (registrationDate == default(DateTime)) throw new ArgumentException("The registration date is required.", "registrationDate"); if (completionDate == default(DateTime)) throw new ArgumentException("The completion date is required.", "completionDate"); if (eventType.ProhibitsVoyage()) throw new ArgumentException("Voyage is not allowed with event type : " + eventType, "eventType"); _eventType = eventType; _completionDate = completionDate; _registrationDate = registrationDate; _location = location; _cargo = cargo; _voyage = voyage; }
public void TestLandMarkLocation() { String address = "Little Oneroa"; ILocation expected = new Location.Location { GeoLat = (decimal)-36.7845550, GeoLong = (decimal)175.027010, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "New Zealand")), (new Tag(TagType.loc, "Auckland")), (new Tag(TagType.loc, "Oneroa")), //(new Tag(TagType.loc, "United Kingdom"))/*, //(new Tag(TagType.loc, "GB"))*/ } }; ILocation location = _target.Parse(address); AssertLocationEquality(address, expected, location); }
public void TestLocationRoundTrip() { Location.Location orig = new Location.Location(); String message = JSON.Serialize(orig); Location.Location deserialized = JSON.Deserialize<Location.Location>(message); Assert.AreEqual(orig.GeoLat, deserialized.GeoLat); Assert.AreEqual(orig.GeoLong, deserialized.GeoLong); Assert.AreEqual(orig.Address, deserialized.Address); Assert.AreEqual(orig.Tags, deserialized.Tags); Assert.AreEqual(orig, deserialized, "Round trip serialization for location false"); }
private Delivery(HandlingEvent lastHandlingEvent, Itinerary itinerary, RouteSpecification specification) { _calculatedAt = DateTime.Now; _lastEvent = lastHandlingEvent; _misdirected = CalculateMisdirectionStatus(itinerary); _routingStatus = CalculateRoutingStatus(itinerary, specification); _transportStatus = CalculateTransportStatus(); _lastKnownLocation = CalculateLastKnownLocation(); _currentVoyage = CalculateCurrentVoyage(); _eta = CalculateEta(itinerary); _nextExpectedActivity = CalculateNextExpectedActivity(specification, itinerary); _isUnloadedAtDestination = CalculateUnloadedAtDestination(specification); }
public void SetupTestData() { _addressToExpectedTags = new SortedList<string, ILocation>(); _target = new GoogleLocationProvider(new WebRequestFactory()); string address = "1600 Amphitheatre Parkway, Mountain View, CA"; ILocation google = new Location.Location { GeoLat = (decimal)37.4217590, GeoLong = (decimal)-122.0843700, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Mountain View")), (new Tag(TagType.loc, "CA")), (new Tag(TagType.loc, "USA"))/*, (new Tag(TagType.loc, "US"))*/ } }; _addressToExpectedTags.Add(address, google); address = "30 Fitzroy Street, New Plymouth"; ILocation fitzroy = new Location.Location { GeoLat = (decimal)-39.0443597, GeoLong = (decimal)174.1080569, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Taranaki")), (new Tag(TagType.loc, "Fitzroy")), (new Tag(TagType.loc, "New Zealand")) /*, (new Tag(TagType.loc, "NZ"))*/ } }; _addressToExpectedTags.Add(address, fitzroy); address = "20 Lambton Quay"; ILocation lambton = new Location.Location { GeoLat = (decimal)-41.2786929, GeoLong = (decimal)174.7785322, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Wellington")), (new Tag(TagType.loc, "Wellington Central")), (new Tag(TagType.loc, "New Zealand")),/*, (new Tag(TagType.loc, "NZ"))*/ } }; _addressToExpectedTags.Add(address, lambton); address = "20 Pitt Street,Sydney"; ILocation sydney = new Location.Location { GeoLat = (decimal)-33.816636, GeoLong = (decimal)150.997453, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "New South Wales")), (new Tag(TagType.loc, "Sydney")), (new Tag(TagType.loc, "Australia"))/*, (new Tag(TagType.loc, "AU"))*/ } }; _addressToExpectedTags.Add(address, sydney); address = "Sheikh+Zayed+Road,+Dubai,+UAE"; ILocation uae = new Location.Location { GeoLat = (decimal) /*25.2286509*/25.0621743, GeoLong = (decimal) /*55.2876798*/55.1302461, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Dubai")), (new Tag(TagType.loc, "Dubai")), (new Tag(TagType.loc, "United Arab Emirates"))/*, (new Tag(TagType.loc, "AE"))*/ } }; _addressToExpectedTags.Add(address, uae); address = "30+Rue+Baudin,+Paris,+France"; ILocation france = new Location.Location { GeoLat = (decimal)48.895, GeoLong = (decimal)2.2520471, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Courbevoie")), (new Tag(TagType.loc, "île-de-france")), (new Tag(TagType.loc, "France"))/*, (new Tag(TagType.loc, "Fr"))*/ } }; _addressToExpectedTags.Add(address, france); address = "30 Borough Rd, London"; ILocation uk = new Location.Location { GeoLat = (decimal)51.4988744, GeoLong = (decimal)-0.1018722, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Camberwell")), (new Tag(TagType.loc, "Greater London")), (new Tag(TagType.loc, "UK"))/*, (new Tag(TagType.loc, "GB"))*/ } }; _addressToExpectedTags.Add(address, uk); address = "halswell"; ILocation halswell = new Location.Location { GeoLat = (decimal)-43.5854361, GeoLong = (decimal)172.5710715, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Halswell")), (new Tag(TagType.loc, "Canterbury")), (new Tag(TagType.loc, "New Zealand")) /*, (new Tag(TagType.loc, "GB"))*/ } }; _addressToExpectedTags.Add(address, halswell); address = "Dilworth street"; ILocation dilworth = new Location.Location { GeoLat = (decimal)-43.5317993, GeoLong = (decimal)172.6019896, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "Riccarton")), (new Tag(TagType.loc, "Canterbury")), (new Tag(TagType.loc, "New Zealand"))/*, (new Tag(TagType.loc, "GB"))*/ } }; _addressToExpectedTags.Add(address, dilworth); address = "Saint Martins"; ILocation stMartins = new Location.Location { GeoLat = (decimal)-43.555463, GeoLong = (decimal)172.6517792, Address = address, Tags = new List<ITag> { (new Tag(TagType.loc, "St Martins")), (new Tag(TagType.loc, "Canterbury")), (new Tag(TagType.loc, "New Zealand"))/*, (new Tag(TagType.loc, "GB"))*/ } }; _addressToExpectedTags.Add(address, stMartins); }
/// <summary> /// Adds a new <see cref="CarrierMovement"/> to the internal list of carrier movements. /// </summary> /// <param name="arrivalLocation">Arrival location.</param> /// <param name="departureTime">Departure time.</param> /// <param name="arrivalTime">Arrival time.</param> /// <returns>Returns updated instance of <see cref="VoyageBuilder"/>.</returns> public VoyageBuilder AddMovement(Location.Location arrivalLocation, DateTime departureTime, DateTime arrivalTime) { _carrierMovements.Add(new CarrierMovement(_departureLocation, arrivalLocation, departureTime, arrivalTime)); _departureLocation = arrivalLocation; return this; }
static MockData() { MSG_COUNT = 6; Offers = new List<string> { "mulch", "car", "vegetables", "garden supplies", "yams", "squash"}; DateTime fixedStart = DateTime.Now.Subtract(TimeSpan.FromDays(365)).ToUniversalTime(); User0 = new TwitterUserPointer("utunga" ); User0.ProfilePicUrl = "http://s3.amazonaws.com/twitter_production/profile_images/82440779/miles_bigger.jpg"; Location0 = new Location.Location { GeoLat = (decimal)-40.9827820, GeoLong = (decimal)174.9561080, Address = "Paekakariki", Tags = new List<ITag> { (new Tag(TagType.loc, "Paekakariki")), (new Tag(TagType.loc, "New Zealand"))/*, (new Tag(TagType.loc, "NZ"))*/} }; User1 = new TwitterUserPointer("utunga"); User1.ProfilePicUrl = "http://s3.amazonaws.com/twitter_production/profile_images/82440779/miles_bigger.jpg"; Location1 = new Location.Location { GeoLat = (decimal)-41.2864800, GeoLong = (decimal)174.7762170, Address = "Wellington City", Tags = new List<ITag> {(new Tag(TagType.loc, "Wellington")),/*Accuracy not high enough for this(new Tag(TagType.loc, "Wellington")),*/ (new Tag(TagType.loc, "New Zealand"))/*,(new Tag(TagType.loc, "NZ"))*/} }; //http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Waiheke+Island&sll=-40.985341,174.95394&sspn=0.012424,0.027895&ie=UTF8&ll=-36.79609,175.095978&spn=0.204268,0.44632&t=h&z=12 User1 = new TwitterUserPointer("shelly"); User1.ProfilePicUrl = "http://s3.amazonaws.com/twitter_production/profile_images/140759410/avatar_bigger.jpg"; Location2 = new Location.Location { GeoLat = (decimal)/*-36.79609 */- 36.7995140, GeoLong = (decimal)/*175.09597*/ 175.0960576, Address = "Waiheke Island", Tags = new List<ITag> { /*(Accuracy not high enough for thisnew Tag(TagType.loc, "Waiheke")),*//*Accuracy not high enough for this(new Tag(TagType.loc, "Auckland")),*/ (new Tag(TagType.loc, "New Zealand"))/*,(new Tag(TagType.loc, "NZ"))*/} }; User2 = new TwitterUserPointer("utunga"); User2.ProfilePicUrl = "http://s3.amazonaws.com/twitter_production/profile_images/82440779/miles_bigger.jpg"; // -- setup facets UsedTags= new List<ITag>(); UsedTags.Add(new Tag(TagType.currency, "cash")); UsedTags.Add(new Tag(TagType.currency, "free")); UsedTags.Add(new Tag(TagType.currency, "barter")); foreach (string offer in Offers) { string tagText = offer.Replace(" ", "_"); UsedTags.Add(new Tag(TagType.tag, tagText)); } foreach(ILocation location in new ILocation[] {Location0,Location1,Location2 }) { foreach (ITag locationTag in location.Tags) { UsedTags.Add(locationTag); } } //---- set up the actual (raw) messages MockRawMessage raw; RawMessages = new List<MockRawMessage>(); //--------- 0 raw = new MockRawMessage(0) { Timestamp = fixedStart, // one year ago CreatedBy = User0, Location = Location0, MoreInfoURL = "http://bit.ly/message0Info", OfferText = Offers[0] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "free")); raw.Tags.Add(new Tag(TagType.currency, "swap")); raw.Tags.Add(new Tag(TagType.currency, "barter")); raw.Tags.Add(new Tag(TagType.tag, Offers[0])); foreach (ITag locationTag in Location0.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); //--------- 1 raw = new MockRawMessage(1) { Timestamp = fixedStart.AddSeconds((365-40)), // more than a month ago CreatedBy = User1, Location = Location1, MoreInfoURL = "http://bit.ly/message1Info", OfferText = Offers[1] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "free")); raw.Tags.Add(new Tag(TagType.currency, "barter")); raw.Tags.Add(new Tag(TagType.tag, Offers[1])); foreach (ITag locationTag in Location1.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); //--------- 2 raw = new MockRawMessage(2) { Timestamp = fixedStart.AddDays((365 - 5)), CreatedBy = User2, Location = Location2, MoreInfoURL = "http://bit.ly/message2Info", OfferText = Offers[2] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "free")); raw.Tags.Add(new Tag(TagType.currency, "barter")); raw.Tags.Add(new Tag(TagType.tag, Offers[2])); foreach (ITag locationTag in Location2.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); //--------- 3 raw = new MockRawMessage(3) { Timestamp = fixedStart.AddDays(363), CreatedBy = User0, Location = Location0, MoreInfoURL = "http://bit.ly/message3Info", OfferText = Offers[3] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "free")); raw.Tags.Add(new Tag(TagType.currency, "barter")); raw.Tags.Add(new Tag(TagType.tag, "garden_supplies")); foreach (ITag locationTag in Location0.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); //--------- 4 raw = new MockRawMessage(4) { Timestamp = fixedStart.AddDays(364.5), CreatedBy = User1, Location = Location2, MoreInfoURL = "http://bit.ly/message4Info", OfferText = Offers[4] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "free")); raw.Tags.Add(new Tag(TagType.currency, "barter")); raw.Tags.Add(new Tag(TagType.tag, Offers[4])); foreach (ITag locationTag in Location2.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); //--------- 5 raw = new MockRawMessage(5) { Timestamp = fixedStart.AddDays(365), CreatedBy = User2, Location = Location2, MoreInfoURL = "http://bit.ly/message5Info", OfferText = Offers[5] + " available now", EndByText = null, EndBy = null }; raw.Tags.Add(new Tag(TagType.group, "ooooby")); raw.Tags.Add(new Tag(TagType.currency, "cash")); raw.Tags.Add(new Tag(TagType.tag, Offers[5])); foreach (ITag locationTag in Location2.Tags) { raw.Tags.Add(locationTag); } raw.Text = raw.ToString(); RawMessages.Add(raw); if (RawMessages.Count != MSG_COUNT) { throw new ApplicationException("Check the MockData class, wrong number of raw messages being returned"); } Users = new List<IUserPointer>() { User0, User1, User2 }; }
public CalendarEventPortable() { //PointsForEvent = new List<CalendarEventPoint>(); Attendees = new List<CalendarAttendance>(); EventType = new CalendarEventType(); Location = new Location.Location(); MembersApartOfEvent = new List<CalendarAttendance>(); MembersToCheckIn = new List<CalendarAttendance>(); GroupsForEvent = new List<LeagueGroup>(); }
public TransportLeg(Location.Location departureLocation, Location.Location arrivalLocation) { DepartureLocation = departureLocation; ArrivalLocation = arrivalLocation; }