Esempio n. 1
0
        public IActionResult GetContactInfo(int id)
        {
            id.CheckLessThanOrEqual(0, nameof(id));
            _logger.LogInformation($"Get contact info for id: '{id}'");

            var result = _contacts.Get(id);

            return(Ok(result));
        }
Esempio n. 2
0
        public void Contacts_Get_All()
        {
            // Set test Get method w/o parameters
            request.Setup(m => m.Get <Response <IEnumerable <Contact> > >("contacts", null)).Returns(new Response <IEnumerable <Contact> >
            {
                Data = new List <Contact>
                {
                    new Contact
                    {
                        Id = 666
                    }
                }
            });

            // Test Get method
            var result = contactsProxy.Get();

            // Verify test
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Data.Count());
            Assert.IsTrue(result.IsSuccessful);
            Assert.AreEqual(666, result.Data.ElementAt(0).Id);
        }