Esempio n. 1
0
        private bool IsIdValid(string id) //Checks that the Generated ID does not have the same name as a public Action
        {
            var temp = new URLController(this, null, null);

            foreach (var i in temp.GetType().GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public))
            {
                if (id.ToLower() == i.Name.ToLower())
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
        public async void URLUnitTest_GetByID()
        {
            //arrange
            InMemoryURLData auxData  = new InMemoryURLData();
            var             _mockURL = new URLController(auxData);


            //act
            string auxString = "algo";
            URL    temp      = await _mockURL.Get(auxString);

            //assert
            Assert.Equal("https://google.com", temp.URLValue);
        }
Esempio n. 3
0
        public void URLUnitTest_InsertURLDuplicateId()
        {
            //arrange
            InMemoryURLData auxData  = new InMemoryURLData();
            var             _mockURL = new URLController(auxData);

            //Act

            URL temp = new URL {
                Id = "algo", URLValue = "https://google.com"
            };

            //assert
            Assert.Throws <ApplicationException>(() => auxData.Insert(temp.Id, temp));
        }
Esempio n. 4
0
        public async Task URLUnitTest_InsertURLAsync()
        {
            //arrange
            InMemoryURLData auxData  = new InMemoryURLData();
            var             _mockURL = new URLController(auxData);

            //Act
            URL temp = new URL {
                Id = "nuevo", URLValue = "https://github.com"
            };

            auxData.Insert(temp.Id, temp);
            temp = await _mockURL.Get(temp.Id);

            //assert
            Assert.Equal(temp.URLValue, temp.URLValue);
        }