コード例 #1
0
        private IShapeProcess StubShapeProcess()
        {
            var shapeProcess = Substitute.For <IShapeProcess>();

            _processFactory.Get(Arg.Any <string>()).Returns(shapeProcess);
            return(shapeProcess);
        }
コード例 #2
0
        public void Start()
        {
            _console.WriteLine(@"Hello and welcome to unfinished Shape calculation program 0.1");
            _console.WriteLine(@"Please choose a shape (case matters): ");
            _console.WriteLine(@"[C]ircle, [S]quare, [T]riangle");
            string shape = _console.ReadLine();

            IShapeProcess process = _processFactory.Get(shape);

            string result = process.Run();

            _console.WriteLine(result);
        }
コード例 #3
0
 public void Invalid_ThrowsException()
 {
     // TODO: a real app would have a more exhaustive test (maybe)
     Assert.Throws <Exception>(() => _factory.Get("blah"));
 }