public void RebelIdentification_RebelIdenfitied_ReturnsTrue() { // Arrange string name = "Rebel_01", planet = "Planet_01"; string expected = $"Rebel {name} on {planet}"; // Act var rebelInfo = new RebelIdentificationReply { Name = name, Planet = planet }; string actual = $"Rebel {rebelInfo.Name} on {rebelInfo.Planet}"; // Assert Assert.AreEqual(expected, actual); }
public bool IdentifyRebel(Rebel rebel) { try { Log.Info("Identifying rebel"); RebelIdentificationReply rebelReply = new RebelIdentificationReply { Name = rebel.Name, Planet = rebel.Planet, IdentificationStatus = "Successful" }; if (rebelReply.Name == null || rebelReply.Planet == null) { throw new CustomException("The name or the planet can not be null"); } RebelIdentification.Add(rebel); System.IO.File.AppendAllText("./Debug/Rebels.txt", $"Rebel { rebelReply.Name } on { rebelReply.Planet } at { DateTime.Now } {Environment.NewLine}"); Log.Info("Rebel identified"); } catch (CustomException ex) { Log.Error($"Rebel could not be identified due to a CustomException caught. Error message: {ex.Message}"); Log.Debug($"StackTrace: {ex.StackTrace}"); Log.Debug($"Source: {ex.Source}"); Log.Debug($"Rebel info: {rebel}"); return(false); } catch (Exception ex) { Log.Error($"Rebel could not be identified due to an Exception caught. Error message: {ex.Message}"); Log.Debug($"StackTrace: {ex.StackTrace}"); Log.Debug($"Source: {ex.Source}"); Log.Debug($"Rebel info: {rebel}"); return(false); } return(true); }