Exemple #1
0
 public void LinkAccessTypeTest()
 {
     // get test
     Assert.That(LinkAccessType.NotBanned.ToString(), Is.EqualTo("not_banned"));
     Assert.That(LinkAccessType.Banned.ToString(), Is.EqualTo("banned"));
     Assert.That(LinkAccessType.Processing.ToString(), Is.EqualTo("processing"));
     // parse test
     Assert.That(LinkAccessType.FromJsonString("not_banned"), Is.EqualTo(LinkAccessType.NotBanned));
     Assert.That(LinkAccessType.FromJsonString("banned"), Is.EqualTo(LinkAccessType.Banned));
     Assert.That(LinkAccessType.FromJsonString("processing"), Is.EqualTo(LinkAccessType.Processing));
 }
Exemple #2
0
        public void CheckLink_NotLink()
        {
            const string url  = "https://api.vk.com/method/utils.checkLink?url=hsfasfsf&access_token=";
            const string json =
                @"{
                    'response': {
                      'status': 'not_banned',
                      'link': 'http://vk.com/'
                    }
                  }";

            var            utils = GetMockedUtilsCategory(url, json);
            LinkAccessType type  = utils.CheckLink("hsfasfsf");

            type.ShouldEqual(LinkAccessType.NotBanned);
        }
Exemple #3
0
        public void LinkAccessTypeTest()
        {
            // get test
            Assert.That(actual: LinkAccessType.NotBanned.ToString(), expression: Is.EqualTo(expected: "not_banned"));
            Assert.That(actual: LinkAccessType.Banned.ToString(), expression: Is.EqualTo(expected: "banned"));
            Assert.That(actual: LinkAccessType.Processing.ToString(), expression: Is.EqualTo(expected: "processing"));

            // parse test
            Assert.That(actual: LinkAccessType.FromJsonString(response: "not_banned")
                        , expression: Is.EqualTo(expected: LinkAccessType.NotBanned));

            Assert.That(actual: LinkAccessType.FromJsonString(response: "banned"), expression: Is.EqualTo(expected: LinkAccessType.Banned));

            Assert.That(actual: LinkAccessType.FromJsonString(response: "processing")
                        , expression: Is.EqualTo(expected: LinkAccessType.Processing));
        }
Exemple #4
0
        public void CheckLink_BannedLink()
        {
            const string url  = "https://api.vk.com/method/utils.checkLink?url=http://www.kreml.ru/‎&access_token=";
            const string json =
                @"{
                    'response': {
                      'status': 'banned',
                      'link': 'http://www.kreml.ru/'
                    }
                  }";

            var utils = GetMockedUtilsCategory(url, json);

            LinkAccessType type = utils.CheckLink("http://www.kreml.ru/‎");

            type.ShouldEqual(LinkAccessType.Banned);
        }