Exemplo n.º 1
0
        public void SelectModifier_WithoutSelect_ReturnsNull()
        {
            // Arrange
            var modifier = new SelectModifier <TestSelect>();

            // Act
            var queryParams = modifier.GetQueryParameters();

            // Assert
            Assert.IsNull(queryParams);
        }
Exemplo n.º 2
0
        public void SelectModifier_CustomModel_ReturnsCorrectQueryParam()
        {
            // Arrange
            var modifier = new SelectModifier <TestSelect>();

            modifier.Select <TestSelectCustomModel>();

            // Act
            var queryParams = modifier.GetQueryParameters();

            // Assert
            Assert.AreEqual(1, queryParams.Count);
            Assert.IsTrue(queryParams.TryGetValue("select", out var select));
            Assert.AreEqual("Name", select);
        }
Exemplo n.º 3
0
        public void SelectModifier_NewExpression_MultipleExpressions_ReturnsCorrectQueryParamForOnlyLastSelect()
        {
            // Arrange
            var modifier = new SelectModifier <TestSelect>();

            modifier.Select <ExtendSelect>();

            // Act
            var queryParams = modifier.GetQueryParameters();

            // Assert
            Assert.AreEqual(1, queryParams.Count);
            Assert.IsTrue(queryParams.TryGetValue("select", out var select));
            Assert.AreEqual("Name,Model(Text),Items(Text),Id", select);
        }
Exemplo n.º 4
0
        public void SelectModifier_NewExpression_SingleSelect_SingleProperty_ReturnsCorrectQueryParam()
        {
            // Arrange
            var modifier = new SelectModifier <TestSelect>();

            modifier.Select <BaseSelect>();

            // Act
            var queryParams = modifier.GetQueryParameters();

            // Assert
            Assert.AreEqual(1, queryParams.Count);
            Assert.IsTrue(queryParams.TryGetValue("select", out var select));
            Assert.AreEqual("Id", select);
        }