private async Task SubmitToRecipient( INotificationSubmitter notificationSubmitter, IGrouping <Diver, Notification> pendingNotificationsForRecipient, Diver recipient, string content) { if (notificationSubmitter == null) { throw new ArgumentNullException(nameof(notificationSubmitter)); } try { await notificationSubmitter.SubmitAsync(recipient, content); foreach (var notification in pendingNotificationsForRecipient) { notification.Sent(); } } catch (Exception ex) { logger.LogError(ex, $"Error submitting notification to {recipient.Fullname}"); } finally { foreach (var notification in pendingNotificationsForRecipient) { notification.TriedSending(); } } }
public void George_Swims_Down_and_Then_Up() { var d = new Diver("George"); Assert.Equal(0, d.GetPosition()); d.SetDirectionDown(); Assert.Equal(0, d.GetPosition()); d.Swim(); d.Swim(); d.Swim(); d.Swim(); d.Swim(); Assert.Equal(-5, d.GetPosition()); d.Swim(); d.Swim(); Assert.Equal(-7, d.GetPosition()); d.SetDirectionUp(); Assert.Equal(-7, d.GetPosition()); d.Swim(); d.Swim(); Assert.Equal(-5, d.GetPosition()); }
public async Task PublishAsync( NotificationType notificationType, string message, IEnumerable <Diver> recipients, Diver currentDiver = null, Guid?relatedEventId = null, Guid?relatedLogbookEntryId = null) { if (recipients == null) { return; } var relatedEvent = relatedEventId != null ? await eventRepository.FindByIdAsync(relatedEventId.Value) : null; var relatedLogbookEntry = relatedLogbookEntryId != null ? await logbookEntryRepository.FindByIdAsync(relatedLogbookEntryId.Value) : null; foreach (var recipient in GetRelevantRecipients(recipients, currentDiver)) { await notificationRepository.InsertAsync( new Notification( recipient, notificationType, message, relatedEvent, relatedLogbookEntry)); } }
public void Marc() { var d = new Diver("Marc"); int position = d.GetPosition(); Assert.Equal(0, position); }
private async Task UpdateDatabaseForRecipient( IGrouping <Diver, Notification> pendingNotificationsForRecipient, Diver recipient, Func <Task> saver) { if (pendingNotificationsForRecipient == null) { throw new ArgumentNullException(nameof(pendingNotificationsForRecipient)); } if (recipient == null) { throw new ArgumentNullException(nameof(recipient)); } try { logger.LogTrace($"Updating database records for {pendingNotificationsForRecipient.Key} ..."); recipient.MarkNotificationChecked(); await saver(); logger.LogTrace($"Database updated for {pendingNotificationsForRecipient.Key}"); } catch (Exception ex) { logger.LogError(ex, $"Error updating database for {pendingNotificationsForRecipient.Key}"); } }
void Setup() { //Set up diver diverPos = transform.FindChild("DiverPos").transform; diver = (GameObject)Instantiate(diverGameObject, diverPos.position, diverPos.rotation); diverRigidbody = diver.GetComponent <Rigidbody> (); diverProps = diver.GetComponent <Diver> (); normalHorizontalSpeed = diverJumpForce.x / 50; trickHorizontalSpeed = normalHorizontalSpeed / 2; diverRigidbody.maxAngularVelocity = 100; verticalSpeed = diverProps.trickSpinSpeed / 120; controllingDiver = false; //Set up platform platform = (GameObject)Instantiate(platformGameObject, platformGameObject.transform.position, Quaternion.identity); platformProps = platform.GetComponent <Platform> (); //Set up jumper jumperPos = platform.transform.FindChild("JumperPos").position; jumper = (GameObject)Instantiate(jumperGameObject, jumperPos, Quaternion.identity); jumperRigidbody = jumper.GetComponent <Rigidbody> (); jumperProps = jumper.GetComponent <Jumper> (); controllingJumper = true; }
public void EquipDiver(Diver diver, Dive dive) { foreach (Equipment equipment in childEquipments) { equipment.EquipDiver(diver, dive); } }
public void Sue_Doesnt_Like_Any_Fish() { var diver = new Diver("Sue"); string desc = diver.GetDescription(); Assert.Equal("Sue doesn't like any fish", desc); }
// Start is called before the first frame update void Start() { diver = GetComponent <Diver>(); level = GetComponent <Level>(); gameOver = false; }
public DiverWindow(Diver toEdit) { dives = new List <Dive>(); String[] divelistb = File.ReadAllText("./divelist.csv").Split('\n'); for (int i = 1; i < divelistb.Length; i++) { dives.Add(new Dive(divelistb[i])); } InitializeComponent(); this.diver = toEdit; this.Board = toEdit.Board; diveList = new List <Dive>(toEdit.Dives); foreach (Dive d in toEdit.Dives) { DiveListBox.Items.Add(d); } DiverNameBox.Text = toEdit.Name; if (diver.Scores.Count == 0) { ChangeScoresButton.IsEnabled = false; } else { hasScores = true; this.scores = toEdit.Scores; } }
protected override void HandleInput(string input) { if (input.Length == 1) { switch (input) { case "O": view.PrintBasicEquipment(model.GetBasicEquipment()); break; case "D": if (!view.PageDown()) { view.ShowMsg("Ne može više nazad!", "red"); } else { view.PrintToConsole(); } break; case "G": if (!view.PageUp()) { view.ShowMsg("Nema dalje!", "red"); } else { view.PrintToConsole(); } break; case "V": view.StateController = new DiversController(model, view); view.StateController.Initialize(); break; case "Q": Environment.Exit(0); break; default: view.ShowMsg("Pročitati uputstva za korištenje!", "red"); break; } } else { Diver diver = model.GetDivers().FirstOrDefault(x => x.name == input); if (diver != null) { view.PrintDiverEquipment(diver); } else { view.ShowMsg("Gdje se skriva, kud je nestao??", "red"); } } }
public CoreState(Diver curDiver, Event curEvent, int completedDives, int totalDives) { this.curDiver = curDiver; this.curEvent = curEvent; this.completedDives = completedDives; this.totalDives = totalDives; this.remainingDives = totalDives - completedDives; }
public void Format(Diver recipient, int notificationCount, StringBuilder htmlBuilder) { htmlBuilder.AppendLine($"<h2>Hallo {recipient.Firstname},</h2>"); htmlBuilder.AppendLine("<p>"); htmlBuilder.AppendLine($"Auf der Tauchbolde-Webseite gibt es {notificationCount} News."); htmlBuilder.AppendLine("</p>"); }
public ActionResult DeleteConfirmed(int id) { Diver diver = db.Divers.Find(id); db.Divers.Remove(diver); db.SaveChanges(); return(RedirectToAction("Index")); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { diver = new Diver(DiverNameBox.Text, Board, diveList.ToArray()); if (hasScores) { diver.Scores = this.scores; } }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { // if an enemy collides with the player, the player escapes the enemy Diver diver = other.gameObject.GetComponent <Diver>(); diver.EscapeEnemy(); } }
public void AddDiver(Diver d) { d.EventName = this.name; divers.Add(d); if (divers.Count == 1) { curDiver = d; } }
public void Paul() { var diver = new Diver("Paul"); diver.AddFish("carp"); string desc = diver.GetDescription(); Assert.Equal("Paul likes carp", desc); }
private void FormatBody(Diver recipient, IEnumerable <Notification> notifications, StringBuilder htmlBuilder) { htmlBuilder.AppendLine("<body>"); headerFormatter.Format(recipient, notifications.Count(), htmlBuilder); listFormatter.Format(notifications, htmlBuilder); footerFormatter.Format(htmlBuilder); htmlBuilder.AppendLine("</html>"); htmlBuilder.AppendLine("</body>"); }
public void John() { var diver = new Diver("John"); diver.AddFish("shark"); string desc = diver.GetDescription(); // GetDescription() Assert.Equal("John likes shark", desc); }
private void OnCollisionEnter(Collision collision) { Diver diver = collision.gameObject.GetComponent <Diver>(); Debug.Log(diver.name); if (diver) { m_animator.SetTrigger("Attack"); } }
public static void PrintEquipmentReturn(DateTime returnDate, Diver diver, ConcreteEquipment equipment) { StringBuilder builder = new StringBuilder(); builder.AppendFormat("{0,-8}{1,-40}", diver.name, equipment.name); builder.AppendFormat("{0, -24}{1,-10}", equipment.loanDate, equipment.maxLoanDays); builder.AppendFormat("{0}", returnDate, equipment.stock); Console.WriteLine(builder.ToString()); }
private void NewDiverButton_Click(object sender, RoutedEventArgs e) { DiverWindow dw = new DiverWindow(createdEvent.Board); dw.ShowDialog(); Diver d = dw.diver; DiverList.Items.Add(d); divers.Add(d); }
void Start() { spawner = GameObject.FindGameObjectWithTag("Spawner") .GetComponent <Spawner>(); diver = GameObject.FindGameObjectWithTag("MiniDiver"); diverScript = diver.GetComponent <Diver> (); allTimeHighScore = PlayerPrefs.GetInt("HighScore"); }
public void DbAddSelectDiver() { int lastId = _divers[0].Id; int newId = Database.AddDiverToDatabase(_divers[0]); Assert.AreNotEqual(lastId, newId); Assert.AreEqual(newId, _divers[0].Id); Diver temp = Database.GetSpecificDiverFromDatabase(_divers[0].Id); Assert.AreEqual(_divers[0].Id, temp.Id); }
public void PrintDiverEquipment(Diver diver) { string print; foreach (ConcreteEquipment equipment in diver.GetDiverEquipment()) { print = string.Format("{0} {1}", equipment.ID, equipment.GetName()); SaveToCache(print); } AddEndLineDecorationToCache(); PrintToConsole(); }
public void Lisa() { var diver = new Diver("Lisa"); diver.AddFish("goldfish"); diver.AddFish("catfish"); diver.AddFish("zander"); string desc = diver.GetDescription(); Assert.Equal("Lisa likes goldfish,catfish,zander", desc); }
public void Dont_Care_About_Casing() { var diver = new Diver("Lisa"); diver.AddFish("GOLDfish"); diver.AddFish("Catfish"); diver.AddFish("zanDer"); string desc = diver.GetDescription(); Assert.Equal("Lisa likes goldfish,catfish,zander", desc); }
/// <inheritdoc /> public async Task SubmitAsync(Diver recipient, string content) { var oldColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine($"Sent notification to {recipient.User.Email}: {content}."); Console.ForegroundColor = oldColor; await Task.FromResult <object>(null); }
void OnMouseDown() { if (currentActiveDiverCount < maximumActiveDiverCount) { currentActiveDiverCount++; //IncreaseFarthestCheckpoint(); GameObject diver = Instantiate(diverPrefab, transform.position, Quaternion.identity); Diver diverComp = diver.GetComponent <Diver>(); diverComp.checkpoints = new List <GameObject>(checkpointObjects); diverComp.Initialize(movementSpeed, carryCapacity, farthestCheckpoint, scroungingTimerLength, this); } }