A test implementation of
IMetadata
.
- Namespace
- Statiq
.Testing - Interfaces
-
- IMetadata
- IReadOnlyDictionary
<string, object> - IReadOnlyCollection
<KeyValuePair <string, object> > - IDictionary
<string, object> - ICollection
<KeyValuePair <string, object> > - IEnumerable
<KeyValuePair <string, object> > - IEnumerable
- Base Types
-
- object
graph BT
Type-->Base0["object"]
Type-.->Interface0["IMetadata"]
click Interface0 "/api/Statiq.Common/IMetadata"
Type-.->Interface1["IReadOnlyDictionary<string, object>"]
Type-.->Interface2["IReadOnlyCollection<KeyValuePair<string, object>>"]
Type-.->Interface3["IDictionary<string, object>"]
Type-.->Interface4["ICollection<KeyValuePair<string, object>>"]
Type-.->Interface5["IEnumerable<KeyValuePair<string, object>>"]
Type-.->Interface6["IEnumerable"]
Type["TestMetadata"]
class Type type-node
Syntax
public class TestMetadata : IMetadata, IReadOnlyDictionary<string, object>,
IReadOnlyCollection<KeyValuePair<string, object>>, IDictionary<string, object>,
ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>,
IEnumerable
Constructors
Name | Summary |
---|---|
TestMetadata |
|
TestMetadata |
|
TestMetadata |
Properties
Name | Property Type | Summary |
---|---|---|
Count | int | |
IsReadOnly | bool | |
Keys | IEnumerable |
|
this[string] | object | |
Values | IEnumerable |
Methods
Name | Return Value | Summary |
---|---|---|
Add |
void | |
Add |
void | |
Clear |
void | |
Contains |
bool | |
ContainsKey |
bool | |
CopyTo |
void | |
GetEnumerator |
IEnumerator |
|
GetRawEnumerator |
IEnumerator |
|
Remove |
bool | |
Remove |
bool | |
TryGetRaw |
bool | |
TryGetValue |
bool |
Extension Methods
Name | Value | Summary |
---|---|---|
AddOrReplaceRange |
void | |
AddRange |
void |
Adds a range of values to a collection.
|
AddRange |
void |
Adds a range of values to a collection.
|
Concat |
IEnumerable |
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
FilterMetadata |
IMetadata |
Gets a new filtered
IMetadata containing only the specified keys and their values. If a key is not present in the current
metadata, it will be ignored and will not be copied to the new metadata object.
|
Get |
object |
Gets the value for the specified key. This method never throws an exception. It will return the specified
default value or null if the key is not found or is
null .
|
Get |
T |
Gets the value for the specified key. This method never throws an exception. It will return the specified
default value if the key is not found or is
null .
|
Get |
T |
Gets the value for the specified key converted to the specified type.
This method never throws an exception. It will return default(T) if the key is not found,
is
null , or the value cannot be converted to T.
|
GetBool |
bool |
Gets the value for the specified key converted to a bool. This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDateTime |
DateTime |
Gets the value for the specified key converted to a
DateTime . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDateTimeOffset |
DateTimeOffset |
Gets the value for the specified key converted to a
DateTimeOffset . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDocument |
IDocument |
Gets the value for the specified key converted to a
IDocument . This method never throws an exception.
It will return null if the key is not found.
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to IDocument .
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to the specified document type.
|
GetDocuments |
IEnumerable |
Gets the value for the specified key converted to a
IReadOnlyList<IDocument> . This method never throws an exception.
It will return null if the key is not found and an empty list if the key is found but contains no items that can be converted to IDocument .
|
GetDocuments |
IEnumerable |
Gets the value for the specified key converted to a
IReadOnlyList<TDocument> . This method never throws an exception.
It will return null if the key is not found and an empty list if the key is found but contains no items that can be converted to the specified document type.
|
GetDynamic |
dynamic |
Gets the value associated with the specified key as a dynamic object. This is equivalent
to calling
as dynamic to cast the value.
|
GetEnumerable |
IEnumerable |
Gets an enumerable that enumerates key-value pairs.
|
GetInt |
int |
Gets the value for the specified key converted to an int. This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetList |
IReadOnlyList |
Gets the value for the specified key converted to a
IReadOnlyList<T> . This method never throws an exception. It will return the specified
default value if the key is not found. Note that if the value is atomic, the conversion operation will succeed and return a list with one item.
|
GetMetadata |
IMetadata |
Gets the value for the specified key converted to a nested
IMetadata . This method never throws an exception.
It will return null if the key is not found.
|
GetNext |
T | |
GetNext |
T | |
GetPath |
NormalizedPath |
Gets the value for the specified key converted to a
NormalizedPath . This method never throws an exception.
It will return the specified default value if the key is not found.
|
GetPrevious |
T | |
GetPrevious |
T | |
GetRaw |
object |
Gets the raw value for the specified key. This method will not materialize
IMetadataValue
values the way other get methods will. A System.Collections.Generic.KeyNotFoundException will be thrown
for missing keys.
|
GetRawEnumerable |
IEnumerable |
Gets an enumerable that enumerates raw key-value pairs
(I.e., the values have not been expanded similar to
TryGetRaw(string, object) ).
|
GetString |
string |
Formats a string value if it exists in the metadata, otherwise returns a default value.
|
GetString |
string |
Gets the value for the specified key converted to a string. This method never throws an exception. It will return the specified
default value if the key is not found.
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
ParallelForEachAsync |
Task | |
ParallelSelectAsync |
Task |
Invokes an async selector in parallel.
|
Parallel |
Task |
Invokes an async selector that returns multiple results in parallel.
|
ParallelWhereAsync |
Task |
|
RemoveAll |
int |
Removes all items that match a predicate from a collection.
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
ThrowIfNull |
T |
From GuardExtensions
|
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToJson |
string | |
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToStringTable |
string | |
TryAdd |
bool | |
TryAdd |
bool | |
TryAddRange |
void | |
TryGetValue |
bool |
Tries to get the value for the specified key.
|
WithoutSettings |
IMetadata | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
|
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
The name of the attribute will be the lower-case key name.
|
XElement |
XElement | |
XElement |
XElement | |
XElement |
XElement |