public void TestGenerateNoStartingRules() { for (int i = 0; i < 100; i++) { Expect.Once.On(m_ResultViewHelper).Method("AddItem"); } IRandom random = m_Mockery.NewMock <IRandom>(); Project project = new Project(random); Rule rule = new Rule(); rule.Name = "root"; rule.Probability = 1.0; rule.LineNumber = 1; Expect.AtLeastOnce.On(random).Method("NextDouble").Will(Return.Value((double)0.5)); LiteralCommand a = new LiteralCommand(); a.Literal = "a"; rule.Commands.Add(a); project.Rules.Add(rule); m_GeneratorController.Generate(project); Assert.AreEqual(1, project.StartRules.Count); m_Mockery.VerifyAllExpectationsHaveBeenMet(); }
void ControlButtons() { Color defaultColor = GUI.backgroundColor; GUI.backgroundColor = Color.green; generateButton.fontStyle = FontStyle.Bold; generateButton = "button"; if (GUILayout.Button("Generate Building", generateButton, GUILayout.Width(130), GUILayout.Height(40))) { generatorController.Generate(); } GUI.backgroundColor = defaultColor; generateButton = "button"; GUILayout.Space(5); GUILayout.BeginHorizontal(); if (GUILayout.Button("Export", GUILayout.Width(130), GUILayout.Height(30))) { if (!String.IsNullOrEmpty(generatorController.path)) { ObjExporter.DoExport(false, generatorController.parentObj, generatorController.path); } } if (GUILayout.Button("Merge Mesh", GUILayout.Width(130), GUILayout.Height(30))) { generatorController.Merge(); } GUILayout.EndHorizontal(); }