public async Task Ajouter_Erabliere_DbSetContientErabliere(ErablieresController erabliereController, PostErabliere postErabliere, ErabliereDbContext erabliereDbContext, IMapper mapper) { var initialSet = new HashSet <Erabliere>(erabliereDbContext.Erabliere); await erabliereController.Ajouter(postErabliere); initialSet.ShouldNotContain(mapper.Map <Erabliere>(postErabliere), _ignoreIdsEqualityComparer); string customMessageFunc() { var sb = new StringBuilder(); sb.AppendLine("erabliereDbContext.Erabliere.ShouldContain"); sb.AppendLine(JsonSerializer.Serialize(mapper.Map <Erabliere>(postErabliere), _ignoreIdsEqualityComparer.JsonSerializerOptions)); sb.AppendLine("But was actually"); foreach (var e in erabliereDbContext.Erabliere) { sb.AppendLine(JsonSerializer.Serialize(e, _ignoreIdsEqualityComparer.JsonSerializerOptions)); } return(sb.ToString()); } var erabliereSansIds = erabliereDbContext.Erabliere.Select(e => mapper.Map <PostErabliere>(e)); erabliereSansIds.ShouldContain(postErabliere, _ignoreIdsEqualityComparer, customMessageFunc()); }
public void ListForks_FromMercurialRepo_ShouldReturnMoreThan10UniqueForks() { repositoryResource.ShouldNotBe(null); var forks = repositoryResource.ListForks(); forks.ShouldNotBe(null); forks.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet<string>(); foreach (var fork in forks){ fork.ShouldNotBe(null); uniqueNames.ShouldNotContain(fork.full_name); uniqueNames.Add(fork.full_name); } }
public void ListWatchers_FromMercurialRepo_ShouldReturnMoreThan10UniqueWatchers() { repositoryResource.ShouldNotBe(null); var watchers = repositoryResource.ListWatchers(); watchers.ShouldNotBe(null); watchers.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet<string>(); foreach (var watcher in watchers){ watcher.ShouldNotBe(null); string id = watcher.username + watcher.display_name; uniqueNames.ShouldNotContain(id); uniqueNames.Add(id); } }
public void ListWatchers_FromMercurialRepo_ShouldReturnMoreThan10UniqueWatchers() { var repositoryResource = SampleRepositories.MercurialRepository; repositoryResource.ShouldNotBe(null); var watchers = repositoryResource.ListWatchers(); watchers.ShouldNotBe(null); watchers.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet<string>(); foreach (var watcher in watchers) { watcher.ShouldBeFilled(); uniqueNames.ShouldNotContain(watcher.uuid); uniqueNames.Add(watcher.uuid); } }
public void ListForks_FromMercurialRepo_ShouldReturnMoreThan10UniqueForks() { repositoryResource.ShouldNotBe(null); var forks = repositoryResource.ListForks(); forks.ShouldNotBe(null); forks.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet <string>(); foreach (var fork in forks) { fork.ShouldNotBe(null); uniqueNames.ShouldNotContain(fork.full_name); uniqueNames.Add(fork.full_name); } }
public void DefaultContextIsIsolatedContext() { var contextHashcodesSeen = new HashSet <int>(); EvaluateProjects( _sdkResolutionProjects, null, p => { var context = GetEvaluationContext(p); context.Policy.ShouldBe(EvaluationContext.SharingPolicy.Isolated); contextHashcodesSeen.ShouldNotContain(context.GetHashCode()); contextHashcodesSeen.Add(context.GetHashCode()); }); }
public void ListWatchers_FromMercurialRepo_ShouldReturnMoreThan10UniqueWatchers() { repositoryResource.ShouldNotBe(null); var watchers = repositoryResource.ListWatchers(); watchers.ShouldNotBe(null); watchers.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet <string>(); foreach (var watcher in watchers) { watcher.ShouldNotBe(null); string id = watcher.username + watcher.display_name; uniqueNames.ShouldNotContain(id); uniqueNames.Add(id); } }
public void ListForks_FromMercurialRepo_ShouldReturnMoreThan10UniqueForks() { var repositoryResource = SampleRepositories.MercurialRepository; repositoryResource.ShouldNotBe(null); var forks = repositoryResource.ListForks(); forks.ShouldNotBe(null); forks.Count.ShouldBeGreaterThan(10); var uniqueNames = new HashSet<string>(); foreach (var fork in forks) { fork.ShouldBeFilled(); // since they are forks of mercurial, their parent should be mercurial fork.parent.ShouldBeFilled(); fork.parent.name.ShouldBe(SampleRepositories.MERCURIAL_REPOSITORY_NAME); uniqueNames.ShouldNotContain(fork.full_name); uniqueNames.Add(fork.full_name); } }
public void Entities_use_reference_equality_if_they_change_id() { var id1a = new Entity <TId>(Id1); var id1b = new Entity <TId>(Id1); var id2 = new Entity <TId>(Id2); id1a.Equals(id1b).ShouldBeTrue(); // this will call GetHashCode() var set = new HashSet <Entity <TId> > { id1a, id2 }; set.ShouldContain(id1b); // now make id1a transient id1a.SetId(DefaultId); set.ShouldContain(id1a); set.ShouldNotContain(id1b); id1a.Equals(id1b).ShouldBeFalse(); }
public void DefaultContextIsIsolatedContext() { var contextHashcodesSeen = new HashSet <int>(); EvaluateProjects( null, p => { var fieldInfo = p.GetType().GetField("_lastEvaluationContext", BindingFlags.NonPublic | BindingFlags.Instance); var obj = fieldInfo.GetValue(p); obj.ShouldBeOfType <EvaluationContext>(); var context = (EvaluationContext)obj; context.Policy.ShouldBe(EvaluationContext.SharingPolicy.Isolated); contextHashcodesSeen.ShouldNotContain(context.GetHashCode()); contextHashcodesSeen.Add(context.GetHashCode()); }); }
public void WhenExportLocationsFromViewUseWithMyLocationAndFields( string myLocCheck, string fieldsString) { WhenSearchIndustryFromCurrentViewUsePage("Foodservice"); var viewPage = new LocationViewUse(TestSetup.Driver); var tableSize = viewPage.TableSize; viewPage .ClickExport(); var exportPage = new PopupLocExportSpec(TestSetup.Driver) .SelectFileType("Excel"); var selectedFields = new HashSet <string>(); Regex.Split(fieldsString.Trim(), @"[ ,]+").Where(x => x != "").ToList().ForEach(f => { switch (f) { case "Status": selectedFields.Add("Status"); exportPage.ClickStatusCheckbox(); break; case "Parent GLN": selectedFields.Add("ParentGLN"); exportPage.ClickParentGlnCheckbox(); break; default: throw new ArgumentException($"Unknown export field: {f}"); } }); exportPage .ClickExport(); new MainPage(TestSetup.Driver) .ClickExportCenterIcon(); var exportCenter = Poll( "Wait for export to become available", 60, 5, () => new ExportCenter(TestSetup.Driver).RefreshPage(), p => p.LatestItemStatus == "Complete"); var filename = exportCenter.LatestItemFileName; exportCenter.DownloadLatestItem(); var path = Path.Combine(TestSetup.Config.DownloadFolder, filename); Wait(TestSetup.Driver, 60, d => File.Exists(path)).ShouldBeTrue(); using (var excel = new ExcelPackage(new FileInfo(path))) { var ws = excel.Workbook.Worksheets["ExportSharedLocation"]; ws.Dimension.Rows.ShouldBe(tableSize + 1); var h = new HashSet <string>(); for (var i = 1; i <= ws.Dimension.Columns; ++i) { var colName = ws.Cells[1, i].Value as string; selectedFields.Remove(colName); h.Add(colName); } selectedFields.ShouldBeEmpty(); if (myLocCheck == "with") { h.ShouldContain("MyLocations"); } else if (myLocCheck == "without") { h.ShouldNotContain("MyLocations"); } } }