Пример #1
0
        public void EqualsIsFalseForDifferentUrls()
        {
            var instance1 = new AlertUrl("http://a.com/b");
            var instance2 = new AlertUrl("https://beee.org/ceee");

            AssertInequalities(instance1, instance2);
        }
Пример #2
0
        public void EqualsIsTrueForEquivalentUrls()
        {
            var instance1 = new AlertUrl("http://a.com/b");
            var instance2 = new AlertUrl("http://a.com/b");

            AssertEqualities(instance1, instance2);
        }
Пример #3
0
        public void DifferentEmailAndUrlAreNotEqual()
        {
            var instance1 = new AlertUrl("[email protected]");
            var instance2 = new AlertEmail("http://abc");

            AssertInequalities(instance1, instance2);
        }
Пример #4
0
        public void EqualsIsFalseForNullUrl()
        {
            var instance = new AlertUrl {
                Url = "http://a.com/b"
            };

            Assert.That(instance, Is.Not.EqualTo(null));
        }
Пример #5
0
        private async Task EnsureSnsUrlSubscription(AlertUrl alert, string snsTopicArn)
        {
            if (string.IsNullOrWhiteSpace(alert.Url))
            {
                throw new ArgumentNullException(nameof(alert.Url));
            }

            var protocol = alert.Url.Split(':').First();

            await EnsureSnsSubscription(snsTopicArn, protocol, alert.Url);
        }
Пример #6
0
        public void SelfEqualIsTrue()
        {
            var instance1 = new AlertUrl("http://a.com/b");
            var instance2 = new AlertEmail("abc");

            Assert.That(instance1, Is.EqualTo(instance1));
            Assert.That(instance2, Is.EqualTo(instance2));

            Assert.That(instance1, Is.Not.EqualTo(instance2));
            Assert.That(instance2, Is.Not.EqualTo(instance1));
        }
Пример #7
0
        public void SameEmailAndUrlAreNotEqual()
        {
            var instance1 = new AlertUrl("a.b.c");
            var instance2 = new AlertEmail("a.b.c");

            // Can't call AssertInequalities because the hashcodes are same for same strings
            // This is ot a problem in practice
            // as emails and urls have different formats

            Assert.That(instance1, Is.Not.EqualTo(instance2));
            Assert.That(instance2, Is.Not.EqualTo(instance1));
        }
Пример #8
0
 protected bool Equals(AlertUrl other)
 {
     return(string.Equals(Url, other.Url));
 }