当前位置: 首页>>代码示例>>C#>>正文


C# Machine.Put方法代码示例

本文整理汇总了C#中Machine.Put方法的典型用法代码示例。如果您正苦于以下问题:C# Machine.Put方法的具体用法?C# Machine.Put怎么用?C# Machine.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Machine的用法示例。


在下文中一共展示了Machine.Put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestReport

        public void TestReport()
        {
            IList<Machine> line = new List<Machine>();
            line.Add(new Machine("mixer", "left"));

            Machine extruder = new Machine("extruder", "center");
            extruder.Put("paste");
            line.Add(extruder);

            Machine oven = new Machine("oven", "right");
            oven.Put("chips");
            line.Add(oven);

            Robot robot = new Robot();
            robot.MoveTo(extruder);
            robot.Pick();

            StringWriter output = new StringWriter();
            Report.report(output, line, robot);

            string expected = "FACTORY REPORT\n"
                              + "Machine mixer\nMachine extruder\n"
                              + "Machine oven bin=chips\n\n"
                              + "Robot location=extruder bin=paste\n" + "========\n";

            Assert.That(expected, Is.EqualTo(output.ToString()));
        }
开发者ID:hamoriz,项目名称:katas,代码行数:27,代码来源:ReportTest.cs

示例2: testReport

        public void testReport()
        {
            IList<Machine> line = new List<Machine>();
            line.Add(new Machine("mixer", "left"));

            Machine extruder = new Machine("extruder", "center");
            extruder.Put("paste");
            line.Add(extruder);

            Machine oven = new Machine("oven", "right");
            oven.Put("chips");
            line.Add(oven);

            Robot robot = new Robot();
            robot.MoveTo(extruder);
            robot.Pick();

            StringWriter output = new StringWriter();
            HtmlReport.report(output, line, robot);

            string expected = "<h1>FACTORY REPORT</h1>\n"
                              + "<h2>mixer</h2>\n"
                              + "<ul>\n"
                              + "<li>location = left</li>\n"
                              + "<li>no bin</li>\n"
                              + "</ul>\n"
                              + "<h2>extruder</h2>\n"
                              + "<ul>\n"
                              + "<li>location = center</li>\n"
                              + "<li>no bin</li>\n"
                              + "</ul>\n"
                              + "<h2>oven</h2>\n"
                              + "<ul>\n"
                              + "<li>location = right</li>\n"
                              + "<li>bin containing chips</li>\n"
                              + "</ul>\n"
                              + "<h2>Robot</h2>\n"
                              + "<ul>\n"
                              + "<li>location = extruder</li>\n"
                              + "<li>bin containing paste</li>\n"
                              + "</ul>\n";

            Assert.That(expected, Is.EqualTo(output.ToString()));
        }
开发者ID:hamoriz,项目名称:katas,代码行数:44,代码来源:HtmlReportTest.cs

示例3: TestRobot

        public void TestRobot()
        {
            Machine sorter = new Machine("Sorter", "left");
            sorter.Put("chips");
            Machine oven = new Machine("Oven", "middle");
            Robot robot = new Robot();

            Assert.That("chips", Is.EqualTo(sorter.Bin));
            Assert.IsNull(oven.Bin);
            Assert.IsNull(robot.Location);
            Assert.IsNull(robot.Bin);

            robot.MoveTo(sorter);
            robot.Pick();
            robot.MoveTo(oven);
            robot.Release();

            Assert.IsNull(robot.Bin);
            Assert.That(oven, Is.EqualTo(robot.Location));
            Assert.IsNull(sorter.Bin);
            Assert.That("chips", Is.EqualTo(oven.Bin));
        }
开发者ID:chrisross10,项目名称:Refactoring-Workbook,代码行数:22,代码来源:RobotTests.cs


注:本文中的Machine.Put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。