コード例 #1
0
ファイル: WriterTest.cs プロジェクト: jnpatel340/CroweHorwath
        public void Program_Console_Exception()
        {
            string ValueWritten = string.Empty;

            //arange
            Writer w = new HelloWorld.Fakes.StubWriter()
            {
                WriteString = (ValueToWrite) =>
                {
                    ValueWritten = ValueToWrite;
                    return(true);
                }
            };

            using (ShimsContext.Create())
            {
                HelloWorld.Fakes.ShimAppSettings.AllInstances.OutputDeviceGet =
                    (a) => { return("asdf"); };
                HelloWorld.Fakes.ShimWriterFactory.CreateOutputDeviceType = (o) =>
                {
                    return(w);
                };
                Program.Main(null);
            }
        }
コード例 #2
0
ファイル: WriterTest.cs プロジェクト: jnpatel340/CroweHorwath
        public void HelloWorl_Write()
        {
            string ValueWritten = string.Empty;
            //arange
            Writer w = new HelloWorld.Fakes.StubWriter()
            {
                WriteString = (ValueToWrite) =>
                {
                    ValueWritten = ValueToWrite;
                    return(true);
                }
            };
            IHelloWriter writer = new HelloWorldWriter(w);

            //act
            writer.Write();

            //assert
            Assert.IsTrue(ValueWritten == "Hello World");
        }