public void constructor_should_initialize_instance()
        {
            var serverSession = Mock.Of <ICoreServerSession>();
            var options       = new CoreSessionOptions();

            var result = new CoreSession(serverSession, options);

            result.Options.Should().BeSameAs(options);
            result.ServerSession.Should().BeSameAs(serverSession);
            result._disposed().Should().BeFalse();
        }
Exemplo n.º 2
0
        public void constructor_should_initialize_instance()
        {
            var cluster       = Mock.Of <ICluster>();
            var serverSession = Mock.Of <ICoreServerSession>();
            var options       = new CoreSessionOptions();

            var result = new CoreSession(cluster, serverSession, options);

            result.Cluster.Should().BeSameAs(cluster);
            result.CurrentTransaction.Should().BeNull();
            result.IsInTransaction.Should().BeFalse();
            result.Options.Should().BeSameAs(options);
            result.ServerSession.Should().BeSameAs(serverSession);
            result._disposed().Should().BeFalse();
        }
Exemplo n.º 3
0
        public void constructor_should_initialize_instance()
        {
            var cluster       = Mock.Of <ICluster>();
            var serverSession = Mock.Of <ICoreServerSession>();
            var options       = new CoreSessionOptions();

#pragma warning disable CS0618 // Type or member is obsolete
            var result = new CoreSession(cluster, serverSession, options);
#pragma warning restore CS0618 // Type or member is obsolete

            result.Cluster.Should().BeSameAs(cluster);
            result.CurrentTransaction.Should().BeNull();
            result.IsInTransaction.Should().BeFalse();
            result.Options.Should().BeSameAs(options);
            result.ServerSession.Should().BeSameAs(serverSession);
            result._disposed().Should().BeFalse();
            result._isCommitTransactionInProgress().Should().BeFalse();
        }
Exemplo n.º 4
0
 public static void EnsureTransactionsAreSupported(this CoreSession obj) => Reflector.Invoke(obj, nameof(EnsureTransactionsAreSupported));
Exemplo n.º 5
0
 public static void _isCommitTransactionInProgress(this CoreSession obj, bool value)
 {
     Reflector.SetFieldValue(obj, nameof(_isCommitTransactionInProgress), value);
 }
Exemplo n.º 6
0
 public static bool _isCommitTransactionInProgress(this CoreSession obj) => (bool)Reflector.GetFieldValue(obj, nameof(_isCommitTransactionInProgress));
Exemplo n.º 7
0
 public static bool _disposed(this CoreSession obj) => (bool)Reflector.GetFieldValue(obj, nameof(_disposed));
Exemplo n.º 8
0
        public static bool _disposed(this CoreSession obj)
        {
            var fieldInfo = typeof(CoreSession).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);

            return((bool)fieldInfo.GetValue(obj));
        }