diff --git a/GBase/DataHandling/Factories/IXmlDataWriterFactory.cs b/GBase/DataHandling/Factories/IXmlDataWriterFactory.cs
index 3c17344..53eb50b 100644
--- a/GBase/DataHandling/Factories/IXmlDataWriterFactory.cs
+++ b/GBase/DataHandling/Factories/IXmlDataWriterFactory.cs
@@ -14,9 +14,7 @@ namespace GBase.DataHandling.Factories
///
/// Creates an
///
- /// The path to the xml file
- /// The root element name of the xml file
/// A newly created instance of the implementation for
- IXmlDataWriter Create(string path, string rootElementName);
+ IXmlDataWriter Create();
}
}
\ No newline at end of file
diff --git a/GBase/DataHandling/XmlDataHandler.cs b/GBase/DataHandling/XmlDataHandler.cs
index 6c79de3..f666969 100644
--- a/GBase/DataHandling/XmlDataHandler.cs
+++ b/GBase/DataHandling/XmlDataHandler.cs
@@ -5,12 +5,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using GBase.DataHandling.Cache.Factories;
using GBase.DataHandling.Factories;
using GBase.Helpers;
+using GBase.Interfaces;
using GBase.Interfaces.DataHandling;
using GBase.Interfaces.DataHandling.Xml;
using GBase.Interfaces.DataHandling.Xml.Cache;
@@ -46,17 +48,15 @@ namespace GBase.DataHandling
/// A that handles its data in an xml file
///
/// The path to the xml file
- /// The root element name of the xml file
/// The factory
/// The factory
/// The factory
public XmlDataHandler(string path,
- string rootElementName,
IXmlDataReaderFactory xmlDataReaderFactory,
IXmlDataWriterFactory xmlDataWriterFactory,
IXmlDataHandlerCacheFactory xmlDataHandlerCacheFactory)
{
- _xmlDataWriter = xmlDataWriterFactory.Create(path, rootElementName);
+ _xmlDataWriter = xmlDataWriterFactory.Create();
_xmlDataReader = xmlDataReaderFactory.Create(path);
_cache = xmlDataHandlerCacheFactory.Create(_xmlDataReader);
@@ -75,9 +75,6 @@ namespace GBase.DataHandling
_overwrite = overwrite;
- if (!await _xmlDataWriter.Init(cancellationToken))
- return false;
-
if (!await _xmlDataReader.Init(cancellationToken))
return false;
@@ -86,6 +83,24 @@ namespace GBase.DataHandling
return true;
}
+ public async Task AddEntry(T entry, IGBaseTable table, FileStream entryFile, CancellationToken cancellationToken)
+ {
+ if (!await _xmlDataWriter.InitFile(entryFile, table.Type.Name, cancellationToken))
+ return false;
+
+ foreach (var column in table.Columns)
+ {
+ //TODO: Set value for each column
+ }
+
+ return true;
+ }
+
+ public Task RemoveEntry(T entry)
+ {
+ throw new NotImplementedException();
+ }
+
///
/// Set the value for the given property
///
@@ -106,7 +121,7 @@ namespace GBase.DataHandling
valueString = value.ToString();
await _cache.SetValue(propertyName, value, _overwrite);
- await _xmlDataWriter.Write(propertyName, valueString, _overwrite);
+ await _xmlDataWriter.Write(TODO, propertyName, valueString, _overwrite, TODO);
}
///
diff --git a/GBase/DataHandling/XmlDataWriter.cs b/GBase/DataHandling/XmlDataWriter.cs
index 3799f0b..40cc62a 100644
--- a/GBase/DataHandling/XmlDataWriter.cs
+++ b/GBase/DataHandling/XmlDataWriter.cs
@@ -18,56 +18,25 @@ namespace GBase.DataHandling
///
public class XmlDataWriter : IXmlDataWriter
{
- private readonly string _rootElementName;
- private readonly FileStream _file;
-
- private XDocument _xmlDocument;
- private XElement _rootElement;
-
- private bool _isInitialized;
- private CancellationToken _cancellationToken;
-
- ///
- /// A that writes to an xml file
- ///
- /// The path to the xml file
- /// The root element name of the xml file
- public XmlDataWriter(string path, string rootElementName)
- {
- _rootElementName = rootElementName;
- _file = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
- }
-
///
/// Initialize the
///
+ ///
+ ///
/// A to cancel the async operation
/// Returns true if successful, false if not
/// No root element found
- public async Task Init(CancellationToken cancellationToken)
+ public async Task InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken)
{
- if (_isInitialized)
+ //if the xml file isn't empty, return
+ if (file.Length > 3) //> 3 because of BOM
return false;
+
+ XDocument xmlDocument = new XDocument();
+ xmlDocument.Add(new XElement(rootElementName));
+ file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it
+ await xmlDocument.SaveAsync(file, SaveOptions.OmitDuplicateNamespaces, cancellationToken);
- _cancellationToken = cancellationToken;
- //if the xml file is empty, write the root element
- if (_file.Length <= 3) //<= 3 because of BOM
- {
- _xmlDocument = new XDocument();
- _xmlDocument.Add(new XElement(_rootElementName));
- _file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it
- await _xmlDocument.SaveAsync(_file, SaveOptions.OmitDuplicateNamespaces, cancellationToken);
- }
- else
- {
- _xmlDocument = await XDocument.LoadAsync(_file, LoadOptions.None, _cancellationToken);
- }
-
- _rootElement = _xmlDocument.Root;//?.Element(_rootElementName);
- if (_rootElement == null)
- throw new Exception("No root element found.");
-
- _isInitialized = true;
return true;
}
@@ -76,18 +45,22 @@ namespace GBase.DataHandling
///
/// The that implements the property
/// The of the property
+ ///
/// The name of the property
/// The value of the property
/// If true an existing value is overwritten, if false an additional value is added
+ ///
/// A to await
///
- public async Task Write(string propertyName, string value, bool overwrite)
+ public async Task Write(FileStream file, string propertyName, string value, bool overwrite, CancellationToken cancellationToken)
{
string typeName = typeof(T).FullName;
if (typeName == null)
throw new ArgumentNullException(nameof(typeName));
+
+ XDocument xmlDocument = await XDocument.LoadAsync(file, LoadOptions.None, cancellationToken);
- _file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it
+ file.Seek(0, SeekOrigin.Begin); //reset stream to it's beginning to be able to save it
XElement typeElement = _rootElement.Element(typeName);
if (typeElement != null) //type element already exists
@@ -126,7 +99,7 @@ namespace GBase.DataHandling
}
//TODO: check if whole file is overwritten (probably) -> performance issues for large files?
- await _xmlDocument.SaveAsync(_file, SaveOptions.OmitDuplicateNamespaces, _cancellationToken); //save the document with the added elements
+ await xmlDocument.SaveAsync(file, SaveOptions.OmitDuplicateNamespaces, cancellationToken); //save the document with the added elements
}
///
@@ -157,15 +130,5 @@ namespace GBase.DataHandling
//TODO: check if whole file is overwritten (probably) -> performance issues for large files?
await _xmlDocument.SaveAsync(_file, SaveOptions.OmitDuplicateNamespaces, _cancellationToken); //save the document with the added elements
}
-
- ///
- /// Dispose used resources asynchronously
- ///
- /// A to await
- public async ValueTask DisposeAsync()
- {
- await _xmlDocument.SaveAsync(_file, SaveOptions.None, _cancellationToken);
- await _file.DisposeAsync();
- }
}
}
\ No newline at end of file
diff --git a/GBase/FileHandling/FileHandler.cs b/GBase/FileHandling/FileHandler.cs
index 88ce20d..e4915bc 100644
--- a/GBase/FileHandling/FileHandler.cs
+++ b/GBase/FileHandling/FileHandler.cs
@@ -57,9 +57,10 @@ namespace GBase.FileHandling
//create new entry file
string filePath = $"{Path.Combine(directoryPath, entry.ToString())}.{GBASE_TABLE_FILE_EXTENSION}";
- FileStream entryFile = File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ FileStream entryFile = File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite); //TODO: Stream has to be disposed
IDataHandler dataHandler = await _dataHandlerPool.RequestDataHandler(this, false, cancellationToken);
+ await dataHandler.AddEntry(entry, table, entryFile, cancellationToken);
}
public Task RemoveEntry(T entry)
diff --git a/GBase/GBase.xml b/GBase/GBase.xml
index cf649c2..ded0749 100644
--- a/GBase/GBase.xml
+++ b/GBase/GBase.xml
@@ -455,16 +455,16 @@
Internal file handler
-
+
- Internal file handler
+ The file extension for all GBase tables
- Factory for the
-
+
- The of this
+ Internal file handler
+ The
@@ -474,7 +474,7 @@
A to cancel the asynchronous operation
True if successful, false if not
-
+
Set the value for the given property
@@ -482,9 +482,10 @@
The of the property
The name of the property
The value to set
+
A to await
-
+
Remove the value for the given property
@@ -492,24 +493,27 @@
The of the property
The name of the property
The value to set
+
A to await
-
+
Get the value for the given property, if multiple values are set the first is returned
The of the property
The of the property
The name of the property
+
The value for the given property
-
+
Get all the values that are set for the given property
The of the property
The of the property
The name of the property
+
An with all the values for the property
@@ -523,11 +527,6 @@
The base class of the GBase database
-
-
- The file extension for all GBase tables
-
-
The base class of the GBase database
@@ -627,7 +626,7 @@
The of the class that this represents
-
+
The name of this
@@ -647,8 +646,8 @@
Initialize this
The of the class that this represents
- The name of this
The path to the database files
+
A to cancel the asynchronous operation
True if successful, false if not
@@ -666,11 +665,12 @@
The given
True if successful, false if not
-
+
Add an entry that implements to this
The entry implementing
+
True if successful, false if not
@@ -960,7 +960,7 @@
A to cancel the asynchronous operation
True if successful, false if not
-
+
Set the value for the given property
@@ -968,9 +968,10 @@
The of the property
The name of the property
The value to set
+
A to await
-
+
Remove the value for the given property
@@ -978,24 +979,27 @@
The of the property
The name of the property
The value to set
+
A to await
-
+
Get the value for the given property, if multiple values are set the first is returned
The of the property
The of the property
The name of the property
+
The value for the given property
-
+
Get all the values that are set for the given property
The of the property
The of the property
The name of the property
+
An with all the values for the property
@@ -1051,11 +1055,12 @@
The entries of this
-
+
Add an entry that implements to this
The entry implementing
+
True if successful, false if not
@@ -1075,7 +1080,7 @@
The of the class that this represents
-
+
The name of this
@@ -1090,9 +1095,10 @@
Initialize this
The of the class that this represents
- The name of this
- /// The path to the database files
+ The path to the database files
+
A to cancel the asynchronous operation
+ ///
True if successful, false if not
diff --git a/GBase/Interfaces/DataHandling/IDataHandler.cs b/GBase/Interfaces/DataHandling/IDataHandler.cs
index cc600be..f42cb82 100644
--- a/GBase/Interfaces/DataHandling/IDataHandler.cs
+++ b/GBase/Interfaces/DataHandling/IDataHandler.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -22,6 +23,10 @@ namespace GBase.Interfaces.DataHandling
/// Returns true if successful, false if not
Task Init(bool overwrite, CancellationToken cancellationToken);
+ Task AddEntry(T entry, IGBaseTable table, FileStream entryFile, CancellationToken cancellationToken);
+
+ Task RemoveEntry(T entry);
+
///
/// Set the value for the given property
///
diff --git a/GBase/Interfaces/DataHandling/IDataWriter.cs b/GBase/Interfaces/DataHandling/IDataWriter.cs
index c049b66..cd65a26 100644
--- a/GBase/Interfaces/DataHandling/IDataWriter.cs
+++ b/GBase/Interfaces/DataHandling/IDataWriter.cs
@@ -3,6 +3,7 @@
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -11,25 +12,29 @@ namespace GBase.Interfaces.DataHandling
///
/// Interface for data writers to implement
///
- public interface IDataWriter : IAsyncDisposable
+ public interface IDataWriter
{
///
/// Initialize the
///
+ ///
+ ///
/// A to cancel the async operation
/// Returns true if successful, false if not
- Task Init(CancellationToken cancellationToken);
+ Task InitFile(FileStream file, string rootElementName, CancellationToken cancellationToken);
///
/// Write the data of a property
///
/// The
/// The of the property
+ ///
/// The name of the property
/// The value of the property
/// If true an existing value is overwritten, if false an additional value is added
+ ///
/// A to await
- Task Write(string propertyName, string value, bool overwrite);
+ Task Write(FileStream file, string propertyName, string value, bool overwrite, CancellationToken cancellationToken);
///
/// Remove the value for the given property
diff --git a/Test.GBase/DataHandling/XmlDataHandlerLocalIntegrationTest.cs b/Test.GBase/DataHandling/XmlDataHandlerLocalIntegrationTest.cs
index 72f4459..afc6caf 100644
--- a/Test.GBase/DataHandling/XmlDataHandlerLocalIntegrationTest.cs
+++ b/Test.GBase/DataHandling/XmlDataHandlerLocalIntegrationTest.cs
@@ -27,8 +27,8 @@ namespace Test.GBase.DataHandling
Assert.Pass(); //Remove this assert.pass() if you want to run this test locally
Mock dataWriterFactoryMock = new Mock();
- dataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny()))
- .Returns((string path, string rootElementName) => new XmlDataWriter(path, rootElementName));
+ dataWriterFactoryMock.Setup(w => w.Create())
+ .Returns(new XmlDataWriter());
Mock dataReaderFactoryMock = new Mock();
dataReaderFactoryMock.Setup(r => r.Create(It.IsAny()))
@@ -48,7 +48,7 @@ namespace Test.GBase.DataHandling
.Returns((IXmlDataReader xmlDataReader) =>
new XmlDataHandlerCache(xmlDataReader, dataHandlerCacheEntryFactoryMock.Object, dataHandlerCachePropertyEntryFactoryMock.Object));
- IXmlDataHandler xmlDataHandler = new XmlDataHandler("TestXml.xml", "Properties", dataReaderFactoryMock.Object, dataWriterFactoryMock.Object,
+ IXmlDataHandler xmlDataHandler = new XmlDataHandler("TestXml.xml", dataReaderFactoryMock.Object, dataWriterFactoryMock.Object,
dataHandlerCacheFactoryMock.Object);
await xmlDataHandler.Init(false, new CancellationToken());
diff --git a/Test.GBase/DataHandling/XmlDataHandlerTest.cs b/Test.GBase/DataHandling/XmlDataHandlerTest.cs
index 699aede..cbf4b4f 100644
--- a/Test.GBase/DataHandling/XmlDataHandlerTest.cs
+++ b/Test.GBase/DataHandling/XmlDataHandlerTest.cs
@@ -28,16 +28,16 @@ namespace Test.GBase.DataHandling
xmlDataReaderFactoryMock.Setup(r => r.Create(It.IsAny())).Returns(xmlDataReaderMock.Object);
Mock xmlDataWriterMock = new Mock();
- xmlDataWriterMock.Setup(w => w.Init(It.IsAny())).ReturnsAsync(true);
+ xmlDataWriterMock.Setup(w => w.InitFile(TODO, TODO, It.IsAny())).ReturnsAsync(true);
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
Assert.True(await xmlDataHandler.Init(false, CancellationToken.None));
@@ -53,16 +53,16 @@ namespace Test.GBase.DataHandling
xmlDataReaderFactoryMock.Setup(r => r.Create(It.IsAny())).Returns(xmlDataReaderMock.Object);
Mock xmlDataWriterMock = new Mock();
- xmlDataWriterMock.Setup(w => w.Init(It.IsAny())).ReturnsAsync(true);
+ xmlDataWriterMock.Setup(w => w.InitFile(TODO, TODO, It.IsAny())).ReturnsAsync(true);
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
Assert.True(await xmlDataHandler.Init(false, CancellationToken.None));
@@ -79,16 +79,16 @@ namespace Test.GBase.DataHandling
xmlDataReaderFactoryMock.Setup(r => r.Create(It.IsAny())).Returns(xmlDataReaderMock.Object);
Mock xmlDataWriterMock = new Mock();
- xmlDataWriterMock.Setup(w => w.Init(It.IsAny())).ReturnsAsync(true);
+ xmlDataWriterMock.Setup(w => w.InitFile(TODO, TODO, It.IsAny())).ReturnsAsync(true);
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
Assert.False(await xmlDataHandler.Init(false, CancellationToken.None));
@@ -104,16 +104,16 @@ namespace Test.GBase.DataHandling
xmlDataReaderFactoryMock.Setup(r => r.Create(It.IsAny())).Returns(xmlDataReaderMock.Object);
Mock xmlDataWriterMock = new Mock();
- xmlDataWriterMock.Setup(w => w.Init(It.IsAny())).ReturnsAsync(false);
+ xmlDataWriterMock.Setup(w => w.InitFile(TODO, TODO, It.IsAny())).ReturnsAsync(false);
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
Assert.False(await xmlDataHandler.Init(false, CancellationToken.None));
@@ -128,19 +128,19 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
await xmlDataHandler.SetValue("property", "SomeString");
xmlDataHandlerCacheMock.Verify(c => c.SetValue("property", "SomeString", false), Times.Once);
- xmlDataWriterMock.Verify(w => w.Write("property", "SomeString", false), Times.Once);
+ xmlDataWriterMock.Verify(w => w.Write(TODO, "property", "SomeString", false, TODO), Times.Once);
}
[Test]
@@ -152,20 +152,20 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
List stringList = new List() {"string", "secondString", "thirdString"};
await xmlDataHandler.SetValue>("property", stringList);
xmlDataHandlerCacheMock.Verify(c => c.SetValue>("property", stringList, false), Times.Once);
- xmlDataWriterMock.Verify(w => w.Write>("property", $"{stringList[0]},{stringList[1]},{stringList[2]}", false), Times.Once);
+ xmlDataWriterMock.Verify(w => w.Write>(TODO, "property", $"{stringList[0]},{stringList[1]},{stringList[2]}", false, TODO), Times.Once);
}
[Test]
@@ -177,19 +177,19 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
await xmlDataHandler.SetValue("property", null);
xmlDataHandlerCacheMock.Verify(c => c.SetValue(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never);
- xmlDataWriterMock.Verify(w => w.Write(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never);
+ xmlDataWriterMock.Verify(w => w.Write(TODO, It.IsAny(), It.IsAny(), It.IsAny(), TODO), Times.Never);
}
[Test]
@@ -201,13 +201,13 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
await xmlDataHandler.RemoveValue("property", "SomeString");
@@ -225,13 +225,13 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
List stringList = new List() { "string", "secondString", "thirdString" };
@@ -250,13 +250,13 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
await xmlDataHandler.RemoveValue("property", null);
@@ -278,13 +278,13 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
}
@@ -301,13 +301,13 @@ namespace Test.GBase.DataHandling
Mock xmlDataWriterMock = new Mock();
Mock xmlDataWriterFactoryMock = new Mock();
- xmlDataWriterFactoryMock.Setup(w => w.Create(It.IsAny(), It.IsAny())).Returns(xmlDataWriterMock.Object);
+ xmlDataWriterFactoryMock.Setup(w => w.Create()).Returns(xmlDataWriterMock.Object);
Mock xmlDataHandlerCacheMock = new Mock();
Mock xmlDataHandlerCacheFactoryMock = new Mock();
xmlDataHandlerCacheFactoryMock.Setup(c => c.Create(It.IsAny())).Returns(xmlDataHandlerCacheMock.Object);
- XmlDataHandler xmlDataHandler = new XmlDataHandler("path", "root", xmlDataReaderFactoryMock.Object,
+ XmlDataHandler xmlDataHandler = new XmlDataHandler("path", xmlDataReaderFactoryMock.Object,
xmlDataWriterFactoryMock.Object, xmlDataHandlerCacheFactoryMock.Object);
IEnumerable> readValues = await xmlDataHandler.GetValues>("property");