Ejemplo n.º 1
0
        public void SlackNotificationClient_WithWrongUrl_ThrowWebException()
        {
            var slackInitParam = new SlackInitParams()
            {
                Channel  = null,
                Username = null,
                Url      = "https://hooks.slack.com/services/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"
            };

            var    slackClient = new SlackNotificationClient(slackInitParam, 0, new JsonSerializer());
            Action result      = () => slackClient.Send(_message);

            result.Should().Throw <WebException>().WithMessage("Serwer zdalny zwrócił błąd: (404) Nie znaleziono.");
        }
Ejemplo n.º 2
0
        public void SlackNotificationClient_CheckSlackConfig_ChangeColor()
        {
            var path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\SlackConfig.json";

            var slackInitParam = new SlackInitParams()
            {
                Channel          = null,
                Username         = null,
                ExtractTheHeader = true,
                Url        = "https://hooks.slack.com/services/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",
                ConfigPath = path
            };

            var    slackClient = new SlackNotificationClient(slackInitParam, 0, new JsonSerializer());
            Action result      = () => slackClient.Send(_message);

            result.Should().Throw <WebException>().WithMessage("Serwer zdalny zwrócił błąd: (404) Nie znaleziono.");
        }