Пример #1
0
        public void Get_CheckProperOutput5()
        {
            //Setup
            var  moq    = new Moq.Mock <IDataSource>();
            bool succes = false;

            moq.Setup(x => x.LoadNames(out succes)).Returns(new List <string>()
            {
                "1aaaa", "2bbbb"
            });
            moq.Setup(x => x.SaveNames(Moq.It.IsAny <List <string> >())).Returns(true);
            //var myMockObjet = new myMoq();
            ValuesController controller = new ValuesController(moq.Object);

            //Do
            JsonResult result = controller.Get2("1", "2", "3");
            //
            //Assert
            string jsonstring = JsonConvert.SerializeObject(result.Value);

            Assert.Equal("{\"Error\":\"Error loading data\"}", jsonstring);
        }