예제 #1
0
        public void MissingFileException()
        {
            Mock <IInputterDialogue <string> > inputterDialogue = new Mock <IInputterDialogue <string> >();

            inputterDialogue.Setup(x => x.Dialogue()).Returns(@".\NonExistantFile.txt");
            FileInputter fileInputterSUT = new FileInputter(inputterDialogue.Object);

            Assert.Throws(typeof(MissingFileException), () => fileInputterSUT.Get());
        }
예제 #2
0
        public void OpenAndReadFileTest()
        {
            Mock <IInputterDialogue <string> > inputterDialogue = new Mock <IInputterDialogue <string> >();

            inputterDialogue.Setup(x => x.Dialogue()).Returns(@".\InputTest1.txt");
            FileInputter fileInputterSUT = new FileInputter(inputterDialogue.Object);

            Assert.AreEqual("testing 123 testing", fileInputterSUT.Get());
        }