Example #1
0
        public void ValidCompositRefTypeKeys_TryBuildForCompositeKey_SuccessfulyBuilt()
        {
            //Arrange
            var builder = new PrimaryKeyExpressionBuilder();

            using var ctx = new MyDbContext();

            //Act
            var buildKeyPredicteOpres = builder
                                        .TryBuildForCompositeKey <string, SameRefTypeKeysComposedEntity>(
                ctx, compostiteKeyParts:
                new[] { "1", "2", "3" });

            //Assert
            Assert.IsTrue(buildKeyPredicteOpres, buildKeyPredicteOpres.ErrorMessage);
        }
Example #2
0
        public void ValidCompositValueTypeKeys_TryBuildForCompositeKey_SuccessfulyBuilt()
        {
            //Arrange
            var builder = new PrimaryKeyExpressionBuilder();

            using var ctx = new MyDbContext();

            //Act
            var buildKeyPredicteOpres = builder.
                                        TryBuildForCompositeKey <int, SameValueTypeComposedKeysEntity>(
                ctx, compostiteKeyParts:
                new[] { 1, 2, 3 });

            //Assert
            Assert.IsTrue(buildKeyPredicteOpres, buildKeyPredicteOpres.ErrorMessage);
        }
Example #3
0
        public void InvalidNumberOfCompositValueTypeKeys_TryBuildForCompositeKey_BuiltFailure()
        {
            //Arrange
            var builder = new PrimaryKeyExpressionBuilder();

            using var ctx = new MyDbContext();

            //Act
            var buildKeyPredicteOpres = builder
                                        .TryBuildForCompositeKey <int, SameValueTypeComposedKeysEntity>(
                ctx, compostiteKeyParts:
                new[] { 1, 2 });

            //Assert
            Assert.IsFalse(buildKeyPredicteOpres, buildKeyPredicteOpres.ErrorMessage);
        }