public bool Equals(DestinyProgressionStepDefinition input) { if (input == null) { return(false); } return (( StepName == input.StepName || (StepName != null && StepName.Equals(input.StepName)) ) && ( DisplayEffectType == input.DisplayEffectType || (DisplayEffectType != null && DisplayEffectType.Equals(input.DisplayEffectType)) ) && ( ProgressTotal == input.ProgressTotal || (ProgressTotal.Equals(input.ProgressTotal)) ) && ( RewardItems == input.RewardItems || (RewardItems != null && RewardItems.SequenceEqual(input.RewardItems)) ) && ( Icon == input.Icon || (Icon != null && Icon.Equals(input.Icon)) )); }
public void TestRetrieve_Only1Week() { ProgressTotal total = new ProgressTotal() { WeightsLastWeek = new List <decimal>() { 108.5m, 108.1m, 108.5m, 108.4m, 108.3m, 108.3m, 107.7m }, Weights2WeeksAgo = new List <decimal>(), Weights3WeeksAgo = new List <decimal>(), Weights4WeeksAgo = new List <decimal>(), User = new WeighInUser() { UserId = "TestUserId", FirstName = "Unit", UserKey = "TestUserKey", StartingWeight = 124m, StartingWeightDate = new DateTime(2018, 6, 15) } }; Assert.That(total.TotalWeightLoss, Is.EqualTo(16.3m)); Assert.That(total.TotalPeriod.Value.Days, Is.GreaterThanOrEqualTo(155)); }
/// <summary> /// Interface class initialization method: associations between all the others classes and timer initialization /// </summary> private void initialize() { mSerialConnection = new CSerialConnection(this); mCSV = new CCSV(this); mSerialCommunication = new CSerialCommunication(this); mDelegateOut = new UpdateUI(UpdateUIMethod); mDelegateLoading = new LoadingState(LoadingStateMethod); mDelegateProgressTotal = new ProgressTotal(ProgressTotalMethod); mDelegateProgressCurrent = new ProgressCurrent(ProgressCurrentMethod); mSerialConnection.COMList(); bInit = false; tmCOMVerification.Tick += new EventHandler(PeriodicCOMVerification); }
public void TestRetrieve_NoUser() { ProgressTotal total = new ProgressTotal() { WeightsLastWeek = new List <decimal>() { 108.5m, 108.1m, 108.5m, 108.4m, 108.3m, 108.3m, 107.7m }, Weights2WeeksAgo = new List <decimal>() { 109.3m, 109.5m, 109.2m, 109.5m, 109.4m, 109.4m, 108.8m }, Weights3WeeksAgo = new List <decimal>() { 109.7m, 110.3m, 109.7m, 109.9m, 109.4m, 109.3m, 109.4m }, Weights4WeeksAgo = new List <decimal>() { 110.8m, 110.3m, 110.7m, 111.0m, 110.4m, 109.9m, 109.8m } }; Assert.That(total.TotalWeightLoss, Is.Null); Assert.That(total.TotalPeriod, Is.Null); }
public string Retrieve(string userId, string firstName) { try { ProgressTotal total = new ProgressTotal(); LoadProgress(userId, firstName, total); return(JsonConvert.SerializeObject(total)); } catch (Exception ex) { Factory.Logger.Log($"Error getting Total Progress with userId=\"{userId}\" and firstName=\"{firstName}\""); Factory.Logger.Log(ex.Message); Factory.Logger.Log(ex.StackTrace); throw new WeighInException(ex.Message); } }
private static void UpdateTotalProgress() { bool downloading = false; int totalProgress = 0; lock (downloads) { if (downloads.Count > 0) { downloading = true; foreach (int epid in startedDownloads) { totalProgress += downloads[epid].ProgressValue; } totalProgress = totalProgress / downloads.Count; } } ProgressTotal?.Invoke(downloading, totalProgress); }
public void TestRetrieve_FullValues() { ProgressTotal total = new ProgressTotal() { WeightsLastWeek = new List <decimal>() { 108.5m, 108.1m, 108.5m, 108.4m, 108.3m, 108.3m, 107.7m }, Weights2WeeksAgo = new List <decimal>() { 109.3m, 109.5m, 109.2m, 109.5m, 109.4m, 109.4m, 108.8m }, Weights3WeeksAgo = new List <decimal>() { 109.7m, 110.3m, 109.7m, 109.9m, 109.4m, 109.3m, 109.4m }, Weights4WeeksAgo = new List <decimal>() { 110.8m, 110.3m, 110.7m, 111.0m, 110.4m, 109.9m, 109.8m }, User = new WeighInUser() { UserId = "TestUserId", FirstName = "Unit", UserKey = "TestUserKey", StartingWeight = 124m, StartingWeightDate = new DateTime(2018, 6, 15) } }; Assert.That(total.TotalWeightLoss, Is.EqualTo(16.3m)); Assert.That(total.TotalPeriod.Value.Days, Is.GreaterThanOrEqualTo(155)); string jsonResult = JsonConvert.SerializeObject(total); Console.WriteLine(jsonResult); Assert.That(jsonResult, Is.Not.Null.And.Not.Empty); }