public void NormalModeGeneration()
 {
   Require.AllFeaturesNotSupported(ProviderFeatures.Sequences);
   Require.AllFeaturesNotSupported(ProviderFeatures.AutoIncrementSettingsInMemory);
   using (var session = Domain.OpenSession())
   using (session.Activate())
   using (var transaction = session.OpenTransaction()) {
     foreach (var keyGenerator in Domain.Configuration.KeyGenerators)
       CheckGeneratorsAfterDomainBuilded(keyGenerator, session, 0);
     for (int i = 0; i < 13; i++ ) {
       new Entity1();
     }
     foreach (var keyGenerator in Domain.Configuration.KeyGenerators)
       CheckGeneratorsAfterDomainBuilded(keyGenerator, session, 0);
     for (int i = 0; i < 120; i++) {
       new Entity1();
     }
     foreach (var keyGenerator in Domain.Configuration.KeyGenerators)
       CheckGeneratorsAfterDomainBuilded(keyGenerator, session, 0);
     for (int i = 0; i < 250; i++) {
       new Entity1();
     }
     foreach (var keyGenerator in Domain.Configuration.KeyGenerators)
       CheckGeneratorsAfterDomainBuilded(keyGenerator, session, 0);
   }
 }
예제 #2
0
        public void FetchTest()
        {
            Require.AllFeaturesNotSupported(ProviderFeatures.Sequences);

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    var named = session.Query.Single <INamed>(33L);
                    Assert.IsNotNull(named);
                    Assert.AreEqual("Name: D'2", named.Name);
                    named = session.Query.Single <INamed>(Key.Create <INamed>(Domain, 51L));
                    Assert.IsNotNull(named);
                    Assert.AreEqual("Name: F0", named.Name);
                    t.Complete();
                }

            const int totalCount = EachCount * 15;
            var       names      = new List <string>(totalCount);

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    for (long i = 1; i <= totalCount; i++)
                    {
                        var key   = Key.Create <INamed>(Domain, i);
                        var named = session.Query.Single <INamed>(key);
                        Assert.IsNotNull(named);
                        Assert.IsNotNull(named.Name);
                        names.Add(named.Name);
                    }
                    t.Complete();
                }

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    var namedQuery = session.Query.All <INamed>()
                                     .Select(i => i.Name)
                                     .OrderBy(i => i)
                                     .ToList();
                    Assert.AreEqual(170, namedQuery.Count);
                    Assert.IsTrue(namedQuery.SequenceEqual(names));
                    t.Complete();
                }
        }
 protected override void CheckRequirements()
 {
     Require.AllFeaturesNotSupported(ProviderFeatures.ExclusiveWriterConnection);
 }
예제 #4
0
 protected override void CheckRequirements() => Require.AllFeaturesNotSupported(ProviderFeatures.Batches);
 public void TestFixtureSetUp()
 {
     Require.ProviderIs(StorageProvider.SqlServer, "Uses native SQL");
     Require.AllFeaturesNotSupported(ProviderFeatures.Sequences);
 }
예제 #6
0
 public void NullableStringToStringSafelyAsyncTest()
 {
     Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
     Assert.ThrowsAsync <SchemaSynchronizationException>(async() => await
                                                         ChangeFieldTypeAsyncTest("FString1", typeof(string), "a", Mode.PerformSafely, 1, null, null, false));
 }
예제 #7
0
 public async Task NullableStringToStringAsyncTest()
 {
     Require.AllFeaturesNotSupported(ProviderFeatures.TreatEmptyStringAsNull);
     await ChangeFieldTypeAsyncTest("FString1", typeof(string), "a", Mode.Perform, 1, null, null, false);
 }
예제 #8
0
        public void FetchTest()
        {
            Require.AllFeaturesNotSupported(ProviderFeatures.Sequences);

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    var named = session.Query.Single <INamed>(33L);
                    Assert.IsNotNull(named);
                    Assert.AreEqual("Name: D'2", named.Name);
                    named = session.Query.Single <INamed>(Key.Create <INamed>(Domain, 51L));
                    Assert.IsNotNull(named);
                    Assert.AreEqual("Name: F0", named.Name);
                    t.Complete();
                }

            const int totalCount = EachCount * 15;
            var       names      = new List <string>(totalCount);

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    for (long i = 1; i <= totalCount; i++)
                    {
                        var key   = Key.Create <INamed>(Domain, i);
                        var named = session.Query.Single <INamed>(key);
                        Assert.IsNotNull(named);
                        Assert.IsNotNull(named.Name);
                        names.Add(named.Name);
                    }
                    t.Complete();
                }

            using (var session = Domain.OpenSession())
                using (var t = session.OpenTransaction()) {
                    var key        = Key.Create <INamed>(Domain, 41L);
                    var namedQuery = session.Query.All <INamed>()
                                     .Select(i => new { i.Key, i.Name })
                                     .OrderBy(i => i.Name)
                                     .ToList(170);
                    Assert.AreEqual(170, namedQuery.Count); // some records are represented twice

                    var groupByKey = namedQuery.GroupBy(i => i.Key, (a, b) => new { Key = a, Items = b.ToList(2) }).ToList(150);
                    Assert.AreEqual(totalCount, groupByKey.Count);

                    var abc = names.Zip(groupByKey,
                                        (name, group) => new {
                        name1 = name,
                        name2 = group.Items.Count == 1
              ? group.Items[0].Name
              : (group.Items[0].Name == name)
                ? group.Items[0].Name
                : group.Items[1].Name
                    });

                    foreach (var anon in abc)
                    {
                        Assert.AreEqual(anon.name1, anon.name2);
                    }

                    t.Complete();
                }
        }