Catbert4.Tests.Controllers.UserManagementControllerTests.UserManagementControllerTests.TestControllerMethodAddUnitContainsExpectedAttributes C# (CSharp) Метод

TestControllerMethodAddUnitContainsExpectedAttributes() приватный Метод

private TestControllerMethodAddUnitContainsExpectedAttributes ( ) : void
Результат void
        public void TestControllerMethodAddUnitContainsExpectedAttributes()
        {
            #region Arrange
            var controllerClass = ControllerClass;
            var controllerMethod = controllerClass.GetMethod("AddUnit");
            #endregion Arrange

            #region Act
            var expectedAttribute = controllerMethod.GetCustomAttributes(true).OfType<HttpPostAttribute>();
            var allAttributes = controllerMethod.GetCustomAttributes(true);
            #endregion Act

            #region Assert
            Assert.AreEqual(1, expectedAttribute.Count(), "HttpPostAttribute not found");
            Assert.AreEqual(1, allAttributes.Count(), "More than expected custom attributes found.");
            #endregion Assert
        }
UserManagementControllerTests