Example #1
0
        public static void Columns_PropertyGet_EqualsCtorArg()
        {
            Identifier            keyName = "test_key";
            const DatabaseKeyType keyType = DatabaseKeyType.Foreign;
            var column  = Mock.Of <IDatabaseColumn>();
            var columns = new[] { column };

            var key = new SqliteDatabaseKey(keyName, keyType, columns);

            Assert.That(key.Columns, Is.EqualTo(columns));
        }
Example #2
0
        public static void Name_PropertyGet_EqualsCtorArg()
        {
            Identifier            keyName = "test_key";
            const DatabaseKeyType keyType = DatabaseKeyType.Primary;
            var column  = Mock.Of <IDatabaseColumn>();
            var columns = new[] { column };

            var key = new SqliteDatabaseKey(keyName, keyType, columns);

            Assert.That(key.Name.UnwrapSome(), Is.EqualTo(keyName));
        }
Example #3
0
        public static void IsEnabled_PropertyGet_ReturnsTrue()
        {
            Identifier            keyName = "test_key";
            const DatabaseKeyType keyType = DatabaseKeyType.Foreign;
            var        column             = Mock.Of <IDatabaseColumn>();
            var        columns            = new[] { column };
            const bool enabled            = true;

            var key = new SqliteDatabaseKey(keyName, keyType, columns);

            Assert.That(key.IsEnabled, Is.EqualTo(enabled));
        }
Example #4
0
        public static void ToString_WhenInvoked_ReturnsExpectedValues(DatabaseKeyType keyType, string name, string expectedResult)
        {
            var keyName = !name.IsNullOrWhiteSpace()
                ? Option <Identifier> .Some(Identifier.CreateQualifiedIdentifier(name))
                : Option <Identifier> .None;

            var column  = Mock.Of <IDatabaseColumn>();
            var columns = new[] { column };

            var key    = new SqliteDatabaseKey(keyName, keyType, columns);
            var result = key.ToString();

            Assert.That(result, Is.EqualTo(expectedResult));
        }