-
Notifications
You must be signed in to change notification settings - Fork 0
/
ITestDataProcessor.cs
96 lines (92 loc) · 5.2 KB
/
ITestDataProcessor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using System;
using System.Linq.Expressions;
using System.Xml.Linq;
using newtelligence.DasBlog.Runtime;
namespace DasBlog.Tests.FunctionalTests.Common
{
public interface ITestDataProcessor
{
/// <summary>
/// get values from config and entry files
/// </summary>
/// <param name="filePathRelativeToEnvironment">
/// e.g. "Config/site.config" or "Content/2018-08-03.dayentry.xml"</param>
/// <param name="xPath">e.g. "/dasb:DayEntry/dasb:Entries/dasb:Entry[dasb:Title='abc']/dasb:EntryId'"
/// ****** CAUTION ******
/// Callers must prefix all the element names with 'dasb:' because the C# XPath mechanism
/// insist that even the default namespace is specified in the xpath</param>
/// <returns>if operation fails then value is null otherwise it is the value identified by xPath</returns>
(bool success, string value) GetValue(string filePathRelativeToEnvironment, string xPath);
/// <param name="key">e.g. "LogDir"</param>
/// <returns>e.g. "/logs/", if operation fails then value is null otherwise it is the value identified by key</returns>
(bool success, string value) GetSiteConfigValue(string key);
/// <param name="email">"[email protected]"</param>
/// <param name="key">e.g. "Role"</param>
/// <returns>e.g. "admin", if operation fails then value is null otherwise it is the value identified by key</returns>
(bool success, string value) GetSiteSecurityConfigValue(string email, string key);
// TODO: what is the behaviour for an empty file?
/// <param name="dt">The date of the blog entry - should match the date in the file name</param>
/// <param name="entryId">typically a GUID</param>
/// <param name="key">e.g. "IsPublic"</param>
/// <returns>e.g. "false", if operation fails then value is null otherwise it is the value identified by key</returns>
(bool success, string value) GetBlogPostValue(DateTime dt, string entryId, string key);
/// <summary>
/// gets the complete contents of the dayentry xml file for the specified date
/// </summary>
/// <param name="dt">should match the date stamp on a dayentry file</param>
/// <returns>success=true, if the file exists otherwise false
/// data=linq ready tree starting at "DayEntry", immediate children "Date" and "Entries"</returns>
(bool success, XElement data) GetBlogPostFileContents(DateTime dt);
/*
/// <summary>
/// set values in config and entry files
/// Either replaces or inserts the value
/// </summary>
/// <param name="filePathRelativeToEnvironment">
/// e.g. "Config/site.config" or "Content/2018-08-03.dayentry.xml"</param>
/// <param name="pathPartsAndValue">e.g. ["[email protected]", "Role", "Contributor"]
/// These parameters are substituted into the appropriate xxlt template</param>
/// <exception cref="Exception">throown if the operation fails. Message provides reason</exception>
void SetValue(string filePathRelativeToEnvironment, params object[] pathPartsAndValue);
*/
/// <param name="key">e.g. "LogDir"</param>
/// <param name="value">.e.g "alternate_logs"</param>
/// <exception cref="Exception">throown if the operation fails. Message provides reason</exception>
void SetSiteConfigValue(string key, string value);
/// <param name="email">"[email protected]"</param>
/// <param name="key">e.g. "Role"</param>
/// <param name="value">e.g. "contributor"</param>
/// <exception cref="Exception">throown if the operation fails. Message provides reason</exception>
void SetSiteSecurityConfigValue(string email, string key, string value);
/// <param name="dt">The date of the blog entry - should match the date in the file name</param>
/// <param name="pred">e.g. entry => entry.EntryId=="abc' </param>
/// <param name="key">e.g. "IsPublic"</param>
/// <param name="value">.e.g "false"</param>
/// <exception cref="Exception">throown if the operation fails. Message provides reason</exception>
void SetBlogPostValue(DateTime dt, Expression<Func<Entry, bool>> pred, string key, object value);
// TODO: what is the behaviour for an empty file?
/// <summary>
/// gets the complete contents of the dayfeedback xml file for the specified date
/// </summary>
/// <param name="dt">should match the date stamp on a dayfeedback file</param>
/// <returns>success=true, if the file exists otherwise false
/// data=linq ready tree starting at DayExtra, immediate children "Date" and "Comments"</returns>
(bool success, XElement data) GetDayExtraFileContents(DateTime dt);
/// <summary>
/// typically used to get comments - maybe other stuff - I don't know
/// </summary>
/// <param name="dt">date forming part of the target filename of the dayfeedback file</param>
/// <param name="entryId">typically a guid</param>
/// <param name="key">e.g. IsPublic</param>
/// <returns>e.g. "false"</returns>
(bool success, string value) GetDayExtraValue(DateTime dt, string entryId, string key);
/// <summary>
/// typically used to replace values in comments
/// </summary>
/// <param name="dt">date forming part of the target filename of the dayfeedback file</param>
/// <param name="entryId">typically a guid</param>
/// <param name="key">e.g. IsPublic</param>
/// <param name="value"></param>
void SetDayExtraValue(DateTime dt, string entryId, string key, string value);
}
}