Skip to content

Commit 49e8363

Browse files
Merge pull request #6 from webexpress-framework/develop
0.0.10-alpha
2 parents e5b00cc + 2058d47 commit 49e8363

160 files changed

Lines changed: 6163 additions & 2517 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/generate-docs.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,21 @@ jobs:
4646
docfx metadata
4747
docfx build
4848
49+
- name: Generate API toc.yaml
50+
run: |
51+
echo "### YamlMime:TableOfContent" > docs/api/toc.yaml
52+
echo "[" >> docs/api/toc.yaml
53+
find docs/_site/api -maxdepth 1 -type f -name '*.html' | sort | while read file; do
54+
name=$(basename "$file" .html)
55+
echo " { \"name\": \"$name\", \"href\": \"$name.html\" }," >> docs/api/toc.yaml
56+
done
57+
sed -i '$ s/},/}/' docs/api/toc.yaml
58+
echo "]" >> docs/api/toc.yaml
59+
4960
- name: Upload artifact
5061
uses: actions/upload-pages-artifact@v3
5162
with:
52-
path: '_site'
63+
path: './docs/_site'
5364

5465
- name: Deploy to GitHub Pages
5566
id: deployment

docs/concept.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,10 @@ methods and properties of this class:
368368
- `Task DeleteAsync<TIndexItem>(TIndexItem item)`: Removes an item from the index asynchronously.
369369
- `void Clear<TIndexItem>()`: Removed all data from the index.
370370
- `Task ClearAsync<TIndexItem>()`: Removed all data from the index asynchronously.
371-
- `IWqlStatement<TIndexItem> Retrieve<T>(string wql)`: Executes a WQL statement.
372-
- `Task<IWqlStatement<TIndexItem>> RetrieveAsync<TIndexItem>(string wql)`: Executes a wql statement asynchronously.
371+
- `IEnumerable<TIndexItem> Retrieve<TIndexItem>(string wql)`: Executes a WQL statement.
372+
- `IEnumerable<TIndexItem> Retrieve<TIndexItem>(IWqlStatement<TIndexItem> wql)`: Executes a WQL statement.
373+
- `Task<IEnumerable<TIndexItem>> RetrieveAsync<TIndexItem>(string wql)`: Executes a wql statement asynchronously.
374+
- `Task<IEnumerable<TIndexItem>> RetrieveAsync<TIndexItem>(IWqlStatement<TIndexItem> wql)`: Executes a wql statement asynchronously.
373375
- `IEnumerable<TIndexItem> All<TIndexItem>()`: Returns all documents from the index.
374376
- `IIndexDocument<TIndexItem> GetIndexDocument<TIndexItem>()`: Returns an index type based on its type.
375377
- `void Dispose()`: Disposes of the resources used by the current instance.

icon.png

6.99 KB
Loading
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
namespace WebExpress.WebIndex.Test.Data
2+
{
3+
/// <summary>
4+
/// Represents an mock item.
5+
/// </summary>
6+
public class IndexItem : IIndexItem
7+
{
8+
private readonly Guid _id = Guid.NewGuid();
9+
10+
/// <summary>
11+
/// Returns the unique identifier associated with this instance.
12+
/// </summary>
13+
public Guid Id => _id;
14+
15+
/// <summary>
16+
/// Returns or sets the name associated with the object.
17+
/// </summary>
18+
public string Name { get; set; }
19+
20+
/// <summary>
21+
/// Returns or sets the integer value associated with this instance.
22+
/// </summary>
23+
public int Value { get; set; }
24+
25+
/// <summary>
26+
/// Returns or sets a value indicating whether the object is active.
27+
/// </summary>
28+
public bool IsActive { get; set; }
29+
30+
/// <summary>
31+
/// Returns or sets the description associated with the object.
32+
/// </summary>
33+
public string Description { get; set; }
34+
35+
/// <summary>
36+
/// Returns or sets the file system path associated with this instance.
37+
/// </summary>
38+
public string Path { get; set; }
39+
40+
/// <summary>
41+
/// Returns or sets the email address associated with the user.
42+
/// </summary>
43+
public string Email { get; set; }
44+
45+
/// <summary>
46+
/// Returns or sets the collection of tags associated with the item.
47+
/// </summary>
48+
public IEnumerable<string> Tags { get; set; }
49+
}
50+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
namespace WebExpress.WebIndex.Test.Data
2+
{
3+
/// <summary>
4+
/// Provides unit tests for deterministic identifier behavior of IndexItem.
5+
/// </summary>
6+
public class UnitTestIndexItem
7+
{
8+
/// <summary>
9+
/// Verifies that the Id property of an IndexItem returns a stable (deterministic)
10+
/// value across multiple accesses on the same instance.
11+
/// </summary>
12+
[Fact]
13+
public void IsStable()
14+
{
15+
// arrange
16+
var item = new IndexItem();
17+
18+
// act
19+
var id1 = item.Id;
20+
var id2 = item.Id;
21+
var id3 = item.Id;
22+
23+
// validation
24+
Assert.Equal(id1, id2);
25+
Assert.Equal(id2, id3);
26+
}
27+
28+
/// <summary>
29+
/// Verifies that two different IndexItem instances have distinct identifiers.
30+
/// </summary>
31+
[Fact]
32+
public void DistinctIds()
33+
{
34+
// arrange
35+
var item1 = new IndexItem();
36+
var item2 = new IndexItem();
37+
38+
// validation
39+
Assert.NotEqual(item1.Id, item2.Id);
40+
}
41+
42+
/// <summary>
43+
/// Verifies that the Id is a non-empty Guid.
44+
/// </summary>
45+
[Fact]
46+
public void IdNotEmpty()
47+
{
48+
// arrange
49+
var item = new IndexItem();
50+
51+
// validation
52+
Assert.NotEqual(Guid.Empty, item.Id);
53+
}
54+
}
55+
}

src/WebExpress.WebIndex.Test/DocumentStore/UnitTestDocumentStoreMemoryA.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public UnitTestDocumentStoreMemoryA(UnitTestIndexFixtureIndexA fixture, ITestOut
2727
[Fact]
2828
public void Create()
2929
{
30-
// preconditions
30+
// arrange
3131
var context = new IndexContext();
3232

33-
// test execution
33+
// act
3434
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(context, 5);
3535

3636
// postconditions
@@ -43,20 +43,20 @@ public void Create()
4343
[Fact]
4444
public void Add()
4545
{
46-
// preconditions
46+
// arrange
4747
Preconditions();
4848
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
4949

5050
documentStore.Clear();
5151

52-
// test execution
52+
// act
5353
documentStore.Add(Fixture.TestData[0]);
5454
documentStore.Add(Fixture.TestData[1]);
5555

5656
var i = documentStore.GetItem(Fixture.TestData[0].Id);
5757

5858
// validation
59-
Assert.True(i != null && i.Id == Fixture.TestData[0].Id);
59+
Assert.True(i is not null && i.Id == Fixture.TestData[0].Id);
6060

6161
// postconditions
6262
documentStore.Dispose();
@@ -69,7 +69,7 @@ public void Add()
6969
[Fact]
7070
public void UpdateWithChange()
7171
{
72-
// preconditions
72+
// arrange
7373
Preconditions();
7474
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
7575

@@ -84,7 +84,7 @@ public void UpdateWithChange()
8484
Text = name,
8585
};
8686

87-
// test execution
87+
// act
8888
documentStore.Update(changed);
8989

9090
var all = documentStore.All;
@@ -103,15 +103,15 @@ public void UpdateWithChange()
103103
[Fact]
104104
public void UpdateWithoutChanges()
105105
{
106-
// preconditions
106+
// arrange
107107
Preconditions();
108108
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
109109

110110
documentStore.Clear();
111111
documentStore.Add(Fixture.TestData[0]);
112112
documentStore.Add(Fixture.TestData[1]);
113113

114-
// test execution
114+
// act
115115
documentStore.Update(Fixture.TestData[0]);
116116
var all = documentStore.All;
117117

@@ -129,15 +129,15 @@ public void UpdateWithoutChanges()
129129
[Fact]
130130
public void Delete()
131131
{
132-
// preconditions
132+
// arrange
133133
Preconditions();
134134
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
135135

136136
documentStore.Clear();
137137
documentStore.Add(Fixture.TestData[0]);
138138
documentStore.Add(Fixture.TestData[1]);
139139

140-
// test execution
140+
// act
141141
documentStore.Delete(Fixture.TestData[0]);
142142
var all = documentStore.All;
143143

@@ -160,15 +160,15 @@ public void Delete()
160160
[Fact]
161161
public void Retrieve()
162162
{
163-
// preconditions
163+
// arrange
164164
Preconditions();
165165
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
166166

167167
documentStore.Clear();
168168
documentStore.Add(Fixture.TestData[0]);
169169
documentStore.Add(Fixture.TestData[1]);
170170

171-
// test execution
171+
// act
172172
var item = documentStore.GetItem(Fixture.TestData[0].Id);
173173

174174
Assert.NotNull(documentStore);
@@ -185,7 +185,7 @@ public void Retrieve()
185185
[Fact]
186186
public void All()
187187
{
188-
// preconditions
188+
// arrange
189189
Preconditions();
190190
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentA>(Context, 5);
191191

@@ -195,7 +195,7 @@ public void All()
195195
documentStore.Add(item);
196196
}
197197

198-
// test execution
198+
// act
199199
var all = documentStore.All;
200200

201201
Assert.True(all.Select(x => x.Id).OrderBy(x => x).SequenceEqual(Fixture.TestData.Select(x => x.Id).OrderBy(x => x)));

src/WebExpress.WebIndex.Test/DocumentStore/UnitTestDocumentStoreMemoryB.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public UnitTestDocumentStoreMemoryB(UnitTestIndexFixtureIndexB fixture, ITestOut
2727
[Fact]
2828
public void Create()
2929
{
30-
// preconditions
30+
// arrange
3131
var context = new IndexContext();
3232

33-
// test execution
33+
// act
3434
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(context, (uint)Fixture.TestData.Count);
3535

3636
// postconditions
@@ -43,21 +43,21 @@ public void Create()
4343
[Fact]
4444
public void Add()
4545
{
46-
// preconditions
46+
// arrange
4747
Preconditions();
4848
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
4949

5050
documentStore.Clear();
5151

52-
// test execution
52+
// act
5353
foreach (var item in Fixture.TestData)
5454
{
5555
documentStore.Add(item);
5656
}
5757

5858
var i = documentStore.GetItem(Fixture.TestData[0].Id);
5959

60-
Assert.True(i != null && i.Id == Fixture.TestData[0].Id);
60+
Assert.True(i is not null && i.Id == Fixture.TestData[0].Id);
6161

6262
// postconditions
6363
documentStore.Dispose();
@@ -70,7 +70,7 @@ public void Add()
7070
[Fact]
7171
public void UpdateWithChange()
7272
{
73-
// preconditions
73+
// arrange
7474
Preconditions();
7575
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
7676
var randomItem = Fixture.RandomItem;
@@ -88,7 +88,7 @@ public void UpdateWithChange()
8888
Name = name,
8989
};
9090

91-
// test execution
91+
// act
9292
documentStore.Update(changed);
9393

9494
var all = documentStore.All;
@@ -107,7 +107,7 @@ public void UpdateWithChange()
107107
[Fact]
108108
public void UpdateWithoutChanges()
109109
{
110-
// preconditions
110+
// arrange
111111
Preconditions();
112112
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
113113
var randomItem = Fixture.RandomItem;
@@ -118,7 +118,7 @@ public void UpdateWithoutChanges()
118118
documentStore.Add(item);
119119
}
120120

121-
// test execution
121+
// act
122122
documentStore.Update(randomItem);
123123
var all = documentStore.All;
124124

@@ -136,7 +136,7 @@ public void UpdateWithoutChanges()
136136
[Fact]
137137
public void Delete()
138138
{
139-
// preconditions
139+
// arrange
140140
Preconditions();
141141
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
142142

@@ -146,7 +146,7 @@ public void Delete()
146146
documentStore.Add(item);
147147
}
148148

149-
// test execution
149+
// act
150150
documentStore.Delete(Fixture.TestData[0]);
151151
var all = documentStore.All;
152152

@@ -163,7 +163,7 @@ public void Delete()
163163
[Fact]
164164
public void Retrieve()
165165
{
166-
// preconditions
166+
// arrange
167167
Preconditions();
168168
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
169169

@@ -173,7 +173,7 @@ public void Retrieve()
173173
documentStore.Add(document);
174174
}
175175

176-
// test execution
176+
// act
177177
var item = documentStore.GetItem(Fixture.TestData[0].Id);
178178

179179
Assert.NotNull(documentStore);
@@ -190,7 +190,7 @@ public void Retrieve()
190190
[Fact]
191191
public void All()
192192
{
193-
// preconditions
193+
// arrange
194194
Preconditions();
195195
var documentStore = new IndexMemoryDocumentStore<UnitTestIndexTestDocumentB>(Context, (uint)Fixture.TestData.Count);
196196

@@ -200,7 +200,7 @@ public void All()
200200
documentStore.Add(item);
201201
}
202202

203-
// test execution
203+
// act
204204
var all = documentStore.All;
205205

206206
Assert.True(all.Select(x => x.Id).OrderBy(x => x).SequenceEqual(Fixture.TestData.Select(x => x.Id).OrderBy(x => x)));

0 commit comments

Comments
 (0)