/// <summary>The get weight data async.</summary> /// <param name="token">The token.</param> /// <param name="startDate">The start Date.</param> /// <param name="endDate">The end Date.</param> /// <returns>The <see cref="Task"/>.</returns> public async Task <IEnumerable <Weight> > GetWeightDataAsync(string token, DateTime startDate, DateTime endDate) { string url = string.Format( FitbitSettings.FitbitUserWeightUrl, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), Guid.NewGuid()); try { if (!this.api.HasAuthenticated) { await this.api.Authenticate(); } WeightCollection weightData = await this.api.Get <WeightCollection>(url); if (weightData.Collection != null && weightData.Collection.Any()) { return(weightData.Collection); } } catch (Exception e) { } return(new List <Weight>()); }
/// <summary> /// Constructor /// </summary> public MutationalEntry() { Description = "Unnamed"; //FuzzPercent = new FromToValue<double>(100); //MaxChanges = new FromToValue<ushort>(0, 2); //ValidOffset = new FromToValue<long>(0, long.MaxValue); Changes = new WeightCollection <MutationalChange>(); }
public void TestEqual() { var collection = new WeightCollection <MutationalChange> ( new MutationalChange() { Weight = 1, Description = "1" }, new MutationalChange() { Weight = 2, Description = "2" } ); var collectionCopy = new WeightCollection <MutationalChange> ( new MutationalChange() { Weight = 1, Description = "1" }, new MutationalChange() { Weight = 2, Description = "2" } ); Assert.IsTrue(collection.Equals(collectionCopy)); Assert.IsTrue(collection.Equals((object)collectionCopy)); Assert.IsFalse(collection.Equals(null)); Assert.AreEqual(collection.GetHashCode(), collectionCopy.GetHashCode()); var collection2 = new WeightCollection <MutationalChange> ( new MutationalChange() { Weight = 1, Description = "1" } ); Assert.IsFalse(collection.Equals(collection2)); Assert.IsFalse(collection.Equals((object)collection2)); Assert.AreNotEqual(collection.GetHashCode(), collection2.GetHashCode()); }