- Kerosene.ORM.zip
- Kerosene.ORM.SqlServer
- Kerosene.ORM
- Configuration
- Core
- Api.Factory
- Api
- Concrete.Engines
- Concrete
- Direct
- Api.Factory
- Api
- Concrete.Engines
- Concrete
- Kerosene.ORM.csproj
- License.txt
- Maps
- Api.Factory
- Api
- Concrete
- Exceptions
- Properties
- Kerosene.Tools
- KeroseneTests.zip
- Kerosene.ORM.Core.Test
- Kerosene.ORM.Direct.Test
- Kerosene.ORM.ExampleDB
- Kerosene.ORM.Maps.Eager.Test
- Kerosene.ORM.Maps.Lazy.Test
- Kerosene.ORM.Maps.Table.Test
- Kerosene.ORM.Performance
- Kerosene.ORM.SqlServer.Test
- Kerosene.Tools.Test
- Kerosene.UnitTester
- KeroseneTests.sln
- kerosene_sources_6_5-noexe.zip
- Kerosene_Sources_6_5.zip
- Blazer
- Blazer.EagerMaps.DataServices.Agnostic
- Blazer.EagerMaps.DataServices.Concrete
- Blazer.EagerMaps.DataServices.Resolver
- Blazer.EagerMaps.Examples
- Blazer.EagerMaps.Pocos
- Blazer.LazyMaps.DataServices.Agnostics
- Blazer.LazyMaps.DataServices.Concrete
- Blazer.LazyMaps.DataServices.Resolver
- Blazer.LazyMaps.Examples
- Blazer.LazyMaps.Pocos
- Blazer.sln
- Blazer.TableMaps.DataServices.Agnostics
- Blazer.TableMaps.DataServices.Concrete
- Blazer.TableMaps.DataServices.Resolver
- Blazer.TableMaps.Examples
- Blazer.TableMaps.Pocos
- Kerosene
- Kerosene.DataServices.Agnostic
- Kerosene.DataServices.Concrete
- Kerosene.ORM.Maps
- Kerosene.ORM.SqlServer
- Kerosene.ORM.Test
- Kerosene.ORM.WCF.Test.Client
- Kerosene.ORM.WCF.Test.Server
- Kerosene.ORM.WCF
- Kerosene.ORM
- Kerosene.sln
- Kerosene.Tools.Test
- Kerosene.Tools
|
// ======================================================== Test_BaseServices.cs
namespace Kerosene.ORM.Maps.Eager.Test
{
using Kerosene.ORM.ExampleDB;
using Kerosene.Tools;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Linq;
// ====================================================
[TestClass]
public class Test_BaseServices
{
[TestMethod]
public void New_TestRepo_Creates_Its_Maps()
{
using (var repo = Repo.Create())
{
Assert.AreEqual(5, repo.Maps.Count());
Assert.IsNotNull(repo.GetMap<Region>()); Assert.IsFalse(repo.GetMap<Region>().IsValidated);
Assert.IsNotNull(repo.GetMap<Country>()); Assert.IsFalse(repo.GetMap<Country>().IsValidated);
Assert.IsNotNull(repo.GetMap<Employee>()); Assert.IsFalse(repo.GetMap<Employee>().IsValidated);
Assert.IsNotNull(repo.GetMap<Talent>()); Assert.IsFalse(repo.GetMap<Talent>().IsValidated);
Assert.IsNotNull(repo.GetMap<EmployeeTalent>()); Assert.IsFalse(repo.GetMap<EmployeeTalent>().IsValidated);
ConsoleEx.WriteLine("\n> Repo: {0}", repo.ToConsoleString());
ConsoleEx.ReadLine("\n--- Press [Enter] to validate...");
foreach (var map in repo.Maps) map.Validate();
ConsoleEx.WriteLine("\n> Validated: {0}", repo.ToConsoleString());
}
}
[TestMethod]
public void Clone_Repository()
{
using (var repo = Repo.Create())
{
foreach (var map in repo.Maps) map.Validate();
ConsoleEx.WriteLine("\n> Source: {0}", repo.ToConsoleString());
var clone = repo.Clone(repo.Link);
ConsoleEx.WriteLine("\n> Cloned: {0}", clone.ToConsoleString());
Assert.AreEqual(repo.Maps.Count(), clone.Maps.Count());
clone.Dispose();
ConsoleEx.WriteLine("\n> Disposed: {0}", clone.ToConsoleString());
Assert.IsNull(clone.Maps);
}
}
[TestMethod]
public void Attach_And_Detach_Entity()
{
var repo = Repo.Instance;
repo.ClearEntities();
var reg = new Region() { Id = "000" };
var meta = EntityFactory.Locate(reg);
Assert.IsNotNull(meta);
Assert.AreEqual(MetaState.Detached, meta.State);
repo.Attach(reg);
Assert.AreEqual(MetaState.Ready, meta.State);
repo.Detach(reg);
Assert.AreEqual(MetaState.Detached, meta.State);
}
}
}
// ========================================================
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
mbarbac has worked in start-ups, multinational tech companies, and consulting ones, serving as CIO, CTO, SW Development Director, and Consulting Director, among many other roles.
Solving complex puzzles and getting out of them business value has ever been among his main interests - and that's why he has spent his latest 25 years trying to combine his degree in Theoretical Physics with his MBA... and he is still trying to figure out how all these things can fit together.
Even if flying a lot across many countries, along with the long working days that are customary in IT management and Consultancy, he can say that, after all, he lives in Spain (at least the weekends).