public void ValidateSetNotificationFlagsInputData_AttributeTypeNotAInteger_ThrowsException()
        {
            // Arrange
            var xDocument = new ShimXDocument
            {
                RootGet = () => new ShimXElement
                {
                    NameGet = () => new ShimXName
                    {
                        LocalNameGet = () => "Notifications"
                    }
                }
            }.Instance;

            ShimXContainer.AllInstances.ElementsXName = (_, elementName) => new List <XElement>
            {
                new ShimXElement
                {
                    Attributes = () => new List <XAttribute>
                    {
                        new XAttribute("ID", DummyInt),
                        new XAttribute("Type", DummyString)
                    },
                    AttributeXName = name => new XAttribute(name, DummyString)
                }
            };

            // Act
            Action action = () => privateType.InvokeStatic(ValidateSetNotificationFlagsInputDataMethodName, xDocument);

            // Assert
            action.ShouldThrow <APIException>();
        }
        public void ValidateSetNotificationFlagsInputData_RootElementNull_ThrowsException()
        {
            // Arrange
            var xDocument = new ShimXDocument
            {
                RootGet = () => null
            }.Instance;

            // Act
            Action action = () => privateType.InvokeStatic(ValidateSetNotificationFlagsInputDataMethodName, xDocument);

            // Assert
            action.ShouldThrow <APIException>();
        }
        public void ValidateSetNotificationFlagsInputData_NoFlagsElements_ThrowsException()
        {
            // Arrange
            const string FlagElement = "Flag";
            var          xDocument   = new ShimXDocument
            {
                RootGet = () => new ShimXElement
                {
                    NameGet = () => new ShimXName
                    {
                        LocalNameGet = () => "Notifications"
                    }
                }
            }.Instance;

            ShimXContainer.AllInstances.ElementsXName = (_, elementName) =>
            {
                if (elementName == FlagElement)
                {
                    return(new List <XElement>());
                }
                else
                {
                    return(new List <XElement>
                    {
                        new ShimXElement
                        {
                            Attributes = () => new List <XAttribute>
                            {
                                new XAttribute("ID", true),
                                new XAttribute("Type", "EMAILED")
                            },
                            AttributeXName = name => new XAttribute(name, DummyInt)
                        }
                    });
                }
            };

            // Act
            Action action = () => privateType.InvokeStatic(ValidateSetNotificationFlagsInputDataMethodName, xDocument);

            // Assert
            action.ShouldThrow <APIException>();
        }
        public void BuildNotificationElement_Should_AddElement()
        {
            // Arrange
            var result = new ShimXDocument
            {
                RootGet = () => new ShimXElement()
            }.Instance;
            var epmNotification = CreateEPMNotification();
            var objectAdded     = new object();

            ShimXContainer.AllInstances.AddObject = (_, element) =>
            {
                objectAdded = element;
            };

            // Act
            privateType.InvokeStatic(BuildNotificationElementMethodName, result, epmNotification);
            var notificationElement = objectAdded as XElement;

            // Assert
            notificationElement.ShouldNotBeNull();
        }
        public void ValidateSetNotificationFlagsInputData_NoNotificationElements_ThrowsException()
        {
            // Arrange
            var xDocument = new ShimXDocument
            {
                RootGet = () => new ShimXElement
                {
                    NameGet = () => new ShimXName
                    {
                        LocalNameGet = () => "Notifications"
                    }
                }
            }.Instance;

            ShimXContainer.AllInstances.ElementsXName = (_, elementName) => new List <XElement>();

            // Act
            Action action = () => privateType.InvokeStatic(ValidateSetNotificationFlagsInputDataMethodName, xDocument);

            // Assert
            action.ShouldThrow <APIException>();
        }