コード例 #1
0
        public void FromWithJoinTest()
        {
            var context = new DatabaseContext(_provider.Object, _settings.Object);

            // Act
            var expression = context.From<Warrior, Armour>((a, w) => a.WarriorID == w.ID);

            Assert.IsNotNull(expression);
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Select));
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.From));
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Join));
        }
コード例 #2
0
        public void FromWithAliasTest()
        {
            var context = new DatabaseContext(_provider.Object, _settings.Object);

            // Act
            var expression = context.From<string>("alias");

            Assert.IsNotNull(expression);
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Select));
            Assert.IsTrue(expression.QueryParts.Parts.Where(p => p.OperationType == OperationType.From).OfType<IEntityPart>().Any(p => p.EntityAlias == "alias"));
        }
コード例 #3
0
        public void FromWithCondition()
        {
            var context = new DatabaseContext(_provider.Object, _settings.Object);

            // Act
            var expression = context.From<Warrior>(w => w.ID == 1);

            Assert.IsNotNull(expression);
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Select));
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.From));
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Where));
        }
コード例 #4
0
        public void FromTest()
        {
            var context = new DatabaseContext(_provider.Object, _settings.Object);

            // Act
            var expression = context.From<string>();

            Assert.IsNotNull(expression);
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.Select));
            Assert.IsTrue(expression.QueryParts.Parts.Any(p => p.OperationType == OperationType.From));
        }