예제 #1
0
        public void Given_An_AttributeTypeId_GetAttributeCategory_Returns_Distinct_Attribute_Categories_In_Sorted_Order()
        {
            int    attributeTypeId = 123456;
            var    response        = GetMpAttributeCategoryResponse();
            string catCols         = "Attribute_Category_ID_table.*";
            string catSearch       = $"attribute_type_id = {attributeTypeId}";
            var    orderBy         = "Attribute_Category_ID_table.Sort_Order";
            bool   distinct        = true;

            _ministryPlatformRestService.Setup(
                mocked =>
                mocked.Search <MpAttribute, MpAttributeCategory>(
                    It.Is <string>(m => m.Equals(catSearch)),
                    It.Is <string>(m => m.Equals(catCols)),
                    It.Is <string>(m => m.Equals(orderBy)),
                    It.Is <bool>(m => m.Equals(distinct)))).Returns(response);

            var attributeCategories = _fixture.GetAttributeCategory(attributeTypeId);

            _ministryPlatformRestService.VerifyAll();

            Assert.IsNotNull(attributeCategories);
            Assert.AreEqual(5, attributeCategories.Count());
        }