protected override async Task TestGetItem() { foreach (var md in FExistingDefinitions) { MarkDefinition md2 = await GetItem(md.GetId()); md.CheckSameValues(md2); } }
public static bool SameValue(this MarkDefinition lhs, MarkDefinition rhs) { return (lhs.Name == rhs.Name && lhs.Description == rhs.Description && lhs.Abbreviation == rhs.Abbreviation && lhs.ShortcutKey == rhs.ShortcutKey && lhs.Colour == rhs.Colour && lhs.Definition == rhs.Definition && lhs.Precedence == rhs.Precedence && lhs.Card == rhs.Card && lhs.Notify == rhs.Notify && lhs.Notification == rhs.Notification && lhs.OriginId == rhs.OriginId && lhs.OriginalId == rhs.OriginalId); }
protected override async Task TestPost() { FNewlyInsertedDefinitions = new List <MarkDefinition>(); Uri uri = new Uri(FBaseUri, "MarkDefinitions"); int numIters = FRandom.Next(4, 10); for (int n = 0; n < numIters; ++n) { string notifyText = GetRandomStringOrEmpty(FRandom.Next(10, 255), true); var newDefn = new MarkDefinition { Abbreviation = GetUniqueAbbreviation(), Name = GetUniqueName(), Card = false, Colour = GetRandomColour(), Definition = GetRandomDef(), Description = GetRandomStringOrEmpty(FRandom.Next(10, 128), true), Notification = notifyText, Notify = !string.IsNullOrWhiteSpace(notifyText), OriginId = null, OriginalId = string.Empty, Precedence = false, ShortcutKey = GetUniqueShortcutKey() }; var response = await FClient.PostAsJsonAsync(uri.ToString(), newDefn); await CheckStatusCodeIs(response, HttpStatusCode.Created); var md = await response.Content.ReadAsAsync <MarkDefinition>(); md.CheckSameValues(newDefn); FNewlyInsertedDefinitions.Add(md); } }