// Author: Gockner, Simon // Created: 2020-11-11 // Copyright(c) 2020 SimonG. All Rights Reserved. using System.Threading; using System.Threading.Tasks; using GBase.Factories; using GBase.Installers; using LightweightIocContainer; using LightweightIocContainer.Interfaces; using NUnit.Framework; namespace Test.GBase.GBaseIntegrationTest { [TestFixture] public class GBaseIntegrationTest { private CancellationTokenSource _cancellationTokenSource; private IIocContainer _iocContainer; [SetUp] public void SetUp() { _cancellationTokenSource = new CancellationTokenSource(); _iocContainer = new IocContainer(); _iocContainer.Install(new GBaseInstaller(), new DataHandlingInstaller(), new FileHandlingInstaller()); } [TearDown] public void TearDown() { _cancellationTokenSource.Dispose(); _iocContainer.Dispose(); } [Test] public async Task TestGBase() { IGBaseFactory gBaseFactory = _iocContainer.Resolve(); Model model = new Model(gBaseFactory); await model.Initialize(_cancellationTokenSource.Token); await model.AddItem(new Item("Item 1", 1), _cancellationTokenSource.Token); await model.AddItem(new Item("Item 2", 2), _cancellationTokenSource.Token); await model.AddItem(new Item("Item 3", 3), _cancellationTokenSource.Token); await model.AddGroup(new Group(1) {Items = { model.Items[0], model.Items[1] }}, _cancellationTokenSource.Token); await model.AddGroup(new Group(2) {Items = { model.Items[1], model.Items[2] }}, _cancellationTokenSource.Token); await model.AddGroup(new Group(3) {Items = { model.Items[0], model.Items[2] }}, _cancellationTokenSource.Token); } } }