Skip to content

Commit 408cbcb

Browse files
committed
fixes #87
1 parent 1004b66 commit 408cbcb

File tree

4 files changed

+41
-17
lines changed

4 files changed

+41
-17
lines changed

extentreports-dotnet-core/Core/ReportObservable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void CollectRunInfo()
257257

258258
foreach (var test in _testList)
259259
{
260-
test.End();
260+
EndTest(test);
261261
CopyContextInfoToObservable(test);
262262
}
263263
}

extentreports-dotnet-core/Core/ReportStatusStats.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public ReportStatusStats(AnalysisStrategy strategy) : this()
218218
public void Refresh(List<Test> testList)
219219
{
220220
Reset();
221-
_testList = testList;
221+
_testList = testList.ToList();
222222
RefreshStats();
223223
}
224224

@@ -304,7 +304,7 @@ private void UpdateGroupCountsBDD(Test test)
304304
if (grandchild.BehaviorDrivenType.GetType() == typeof(Scenario))
305305
{
306306
IncrementItemCountByStatus(ItemLevel.Child, grandchild.Status);
307-
grandchild.NodeContext.All().ToList()
307+
grandchild.NodeContext.All()
308308
.ForEach(x => IncrementItemCountByStatus(ItemLevel.GrandChild, x.Status));
309309
}
310310
else
@@ -335,7 +335,7 @@ private void UpdateGroupCountsTestStrategyChildren(Test test)
335335
{
336336
if (test.HasChildren)
337337
{
338-
foreach (var node in test.NodeContext.All().ToList())
338+
foreach (var node in test.NodeContext.All())
339339
{
340340
if (node.HasChildren)
341341
{

extentreports-dotnet-core/Model/AbstractStructure.cs

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AventStack.ExtentReports.Model
88
[Serializable]
99
public class GenericStructure<T>
1010
{
11-
private BlockingCollection<T> _list
11+
private List<T> _list
1212
{
1313
get
1414
{
@@ -22,64 +22,88 @@ private BlockingCollection<T> _list
2222
}
2323
}
2424
}
25-
private BlockingCollection<T> _listv = new BlockingCollection<T>();
25+
private List<T> _listv = new List<T>();
2626

2727
private readonly object _syncLock = new object();
2828

2929
public bool IsEmpty
3030
{
3131
get
3232
{
33-
return Count == 0;
33+
lock (_syncLock)
34+
{
35+
return Count == 0;
36+
}
3437
}
3538
}
3639

3740
public int Count
3841
{
3942
get
4043
{
41-
return _list == null ? 0 : _list.Count;
44+
lock (_syncLock)
45+
{
46+
return _list == null ? 0 : _list.Count;
47+
}
4248
}
4349
}
4450

4551
public bool Contains(T t)
4652
{
47-
return _list.Contains(t);
53+
lock (_syncLock)
54+
{
55+
return _list.Contains(t);
56+
}
4857
}
4958

5059
public void Add(T t)
5160
{
52-
_list.Add(t);
61+
lock (_syncLock)
62+
{
63+
_list.Add(t);
64+
}
5365
}
5466

5567
public void Remove(T t)
5668
{
57-
_list.ToList().Remove(t);
69+
lock (_syncLock)
70+
{
71+
_list.ToList().Remove(t);
72+
}
5873
}
5974

6075
public T Get(int index)
6176
{
62-
return _list.ElementAt(index);
77+
lock (_syncLock)
78+
{
79+
return _list.ElementAt(index);
80+
}
6381
}
6482

6583
public T FirstOrDefault()
6684
{
67-
return _list.Count == 0 ? default(T) : Get(0);
85+
lock (_syncLock)
86+
{
87+
return _list.Count == 0 ? default(T) : Get(0);
88+
}
6889
}
6990

7091
public T LastOrDefault()
7192
{
72-
return _list.Count == 0 ? default(T) : Get(_list.Count - 1);
93+
lock (_syncLock)
94+
{
95+
return _list.Count == 0 ? default(T) : Get(_list.Count - 1);
96+
}
7397
}
7498

75-
public BlockingCollection<T> All()
99+
public List<T> All()
76100
{
77101
return _list;
78102
}
79103

80104
public TIterator<T> GetEnumerator()
81105
{
82-
return new TIterator<T>(_list.GetConsumingEnumerable().ToList());
106+
return new TIterator<T>(_list);
83107
}
84108
}
85109
}

extentreports-dotnet-core/Service/TestRemoveService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private static void FindAndRemoveTest(List<Test> testList, Test test)
3030
{
3131
if (_removed)
3232
return;
33-
FindAndRemoveTest(t.NodeContext.All().ToList(), test);
33+
FindAndRemoveTest(t.NodeContext.All(), test);
3434
}
3535
}
3636

0 commit comments

Comments
 (0)