|
|
|
|
@ -0,0 +1,45 @@ |
|
|
|
|
// Author: Gockner, Simon |
|
|
|
|
// Created: 2020-03-09 |
|
|
|
|
// Copyright(c) 2020 SimonG. All Rights Reserved. |
|
|
|
|
|
|
|
|
|
using System.Threading; |
|
|
|
|
using GBase; |
|
|
|
|
using GBase.Factories; |
|
|
|
|
using GBase.FileHandling.Factories; |
|
|
|
|
using GBase.Interfaces; |
|
|
|
|
using GBase.Interfaces.FileHandling; |
|
|
|
|
using Moq; |
|
|
|
|
using NUnit.Framework; |
|
|
|
|
using Test.GBase.TestClasses; |
|
|
|
|
|
|
|
|
|
namespace Test.GBase |
|
|
|
|
{ |
|
|
|
|
[TestFixture] |
|
|
|
|
public class GBaseTableIntegrationTest |
|
|
|
|
{ |
|
|
|
|
[Test] |
|
|
|
|
public void TestEntryHandling() |
|
|
|
|
{ |
|
|
|
|
Mock<IFileHandlerFactory> fileHandlerFactoryMock = new Mock<IFileHandlerFactory>(); |
|
|
|
|
fileHandlerFactoryMock.Setup(f => f.Create()).Returns(new Mock<IFileHandler>().Object); |
|
|
|
|
|
|
|
|
|
Mock<IGBaseColumnFactory> gBaseColumnFactoryMock = new Mock<IGBaseColumnFactory>(); |
|
|
|
|
gBaseColumnFactoryMock.Setup(c => c.Create()).Returns(new GBaseColumn()); |
|
|
|
|
|
|
|
|
|
IGBaseTable table = new GBaseTable(fileHandlerFactoryMock.Object, gBaseColumnFactoryMock.Object); |
|
|
|
|
table.Init(typeof(Foo), nameof(Foo), "", CancellationToken.None); |
|
|
|
|
|
|
|
|
|
Foo foo = new Foo("Test"); |
|
|
|
|
table.AddEntry(foo); |
|
|
|
|
|
|
|
|
|
Foo foo2 = new Foo("Test2"); |
|
|
|
|
table.AddEntry(foo2); |
|
|
|
|
|
|
|
|
|
foo.Name = "Foo - ex Test"; |
|
|
|
|
foo2.Name = "Some Name"; |
|
|
|
|
|
|
|
|
|
Assert.AreEqual(foo.Name, ((Foo) table.Entries[0]).Name); |
|
|
|
|
Assert.AreEqual(foo2.Name, ((Foo) table.Entries[1]).Name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |