Пример #1
0
        public void NullAndMissingUrlValues()
        {
            // When URL is null (which should never really happen), the URI string
            // should be empty.
            IKeePassEntry nullUrl = new MockEntry
            {
                Url = null
            };

            Assert.AreEqual(string.Empty, nullUrl.ConstructUriString());
            Assert.IsNull(nullUrl.GetLaunchableUri());

            // Basic test case for empty string (common case)
            IKeePassEntry emptyUrl = new MockEntry
            {
                Url = new UnprotectedString(string.Empty)
            };

            Assert.AreEqual(string.Empty, emptyUrl.ConstructUriString());
            Assert.IsNull(emptyUrl.GetLaunchableUri());

            // When OverrideUrl is not null, but empty, it is ignored
            IKeePassEntry emptyOverride = new MockEntry
            {
                Url = new UnprotectedString("http://example.com/"),
                OverrideUrl = string.Empty
            };

            Assert.AreEqual(emptyOverride.Url.ClearValue, emptyOverride.ConstructUriString());
            Assert.IsNotNull(emptyOverride.GetLaunchableUri());
        }
Пример #2
0
        public void InvalidOverrideUrl()
        {
            IKeePassEntry entry = new MockEntry
            {
                Url = new UnprotectedString(ValidUrl),
                OverrideUrl = InvalidUrl
            };

            Assert.AreEqual(InvalidUrl, entry.ConstructUriString());
            Assert.IsNull(entry.GetLaunchableUri());
        }
Пример #3
0
        public void ValidOverrideUrl()
        {
            IKeePassEntry entry = new MockEntry
            {
                Url = new UnprotectedString(ValidUrl),
                OverrideUrl = ValidOverride
            };

            Assert.AreEqual(ValidOverride, entry.ConstructUriString());
            Assert.AreEqual(ValidOverride, entry.GetLaunchableUri().AbsoluteUri);
        }