Пример #1
0
        public void testGetToollistFromToolService()
        {
            string output           = @"{""toollist"":[{""toolID"":10,""toolLabel"":""this is a label""}]}";
            var    toolProviderMock = Substitute.For <IToolServiceProvider>();

            toolProviderMock.GetToolListAsync(1).Returns(Task.FromResult(output));

            ToolService target = new ToolService(toolProviderMock);
            ToolList    list   = target.GetToolList(1).Result;

            toolProviderMock.Received().GetToolListAsync(1);
            Assert.AreEqual(1, list.toollist.Count, "List Should have 1 object");
            Assert.AreEqual("this is a label", list.toollist[0].toolLabel, "Tool label is incorrect");
        }