Datei: IntegrationTests/NdoUnitTests/QueryCacheTests.cs
Last Commit (98730da)
1 | -- File didn't exist -- |
New Commit (7586755)
1 | using NDO.Logging; |
2 | using NUnit.Framework; |
3 | using Reisekosten.Personal; |
4 | using System; |
5 | using System.Collections.Generic; |
6 | using System.Linq; |
7 | using System.Text; |
8 | using System.Threading.Tasks; |
9 | |
10 | namespace NdoUnitTests |
11 | { |
12 | ····[TestFixture] |
13 | ····public class QueryCacheTests |
14 | ····{ |
15 | ········void CreateObject() |
16 | ········{ |
17 | ············var pm = PmFactory.NewPersistenceManager(); |
18 | ············Mitarbeiter m = new Mitarbeiter(); |
19 | ············m.Vorname = "Mirko"; |
20 | ············m.Nachname = "Matytschak"; |
21 | ············pm.MakePersistent( m ); |
22 | ············pm.Save(); |
23 | ········} |
24 | |
25 | ········[Test] |
26 | ········public void TestSimpleQuery() |
27 | ········{ |
28 | ············CreateObject(); |
29 | ············var pm = PmFactory.NewPersistenceManager(); |
30 | ············Assert.That( pm.QueryCache.Count, Is.EqualTo( 0 ) ); |
31 | ············pm.UseQueryCache = true; |
32 | ············var result = pm.Objects<Mitarbeiter>().ResultTable; |
33 | ············Assert.That( pm.QueryCache.Count, Is.EqualTo( 1 ) ); |
34 | ············pm.VerboseMode = true; |
35 | ············var testAdapter = new TestLogAdapter(); |
36 | ············pm.LogAdapter = testAdapter; |
37 | ············result = pm.Objects<Mitarbeiter>().ResultTable; |
38 | ············Assert.That( testAdapter.Text == "Getting results from QueryCache" ); |
39 | ········} |
40 | ····} |
41 | } |
42 |