コード例 #1
0
        public async Task GetTemplateProject_Should_Use_Defaults()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Sample",
                                               It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
The template ""mytemplate"" was created successfully.
",
                Error    = "",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate");

            // Assert
            var file = Assert.IsType <FileContentResult>(result);

            file.ContentType.Should().Be("application/zip");
            file.FileDownloadName.Should().Be("Sample.zip");
        }
コード例 #2
0
ファイル: PlayArea.cs プロジェクト: prabhjotSL/CardGame-1
    public void NewControllerRune(Rune rune, Action action)
    {
        NewController nc = rune as NewController;

        if (playHands == null)
        {
            playFields = new Dictionary <string, List <CardAvatar> >();
            playHands  = new Dictionary <string, List <CardAvatar> >();
        }
        if (nc.is_me)
        {
            this.homeGuid = nc.uid.ToString();
            playFields.Add(homeGuid, new List <CardAvatar>());
            playHands.Add(homeGuid, new List <CardAvatar>());
        }
        else
        {
            this.awayGuid = nc.uid.ToString();
            playFields.Add(awayGuid, new List <CardAvatar>());
            playHands.Add(awayGuid, new List <CardAvatar>());
        }
        if (awayGuid != null && homeGuid != null)
        {
            string str = "{\"message_type\":\"ready\"}";
            GetComponent <Client>().SendNewMessage(str);
        }

        action();
        action = null;
    }
コード例 #3
0
        public async Task GetTemplateProject_UnknownOutput_Should_Return_InternalServerError()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync(It.IsAny <string>(), It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
Unexpected output.
",
                Error    = "",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate");

            // Assert
            var internalServerError = Assert.IsType <ObjectResult>(result);

            internalServerError.StatusCode.Should().Be(StatusCodes.Status500InternalServerError);
            internalServerError.Value.Should().Be("Unexpected output.");
        }
コード例 #4
0
        public async Task GetTemplateProject_UnknownParameter_Should_Return_NotFound()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c =>
                           c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Sample --myoption=unknown",
                                          It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = "",
                Error    = @"
Error: Invalid parameter(s):
--myoption unknown
    'unknown' is not a valid value for --myoption
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate", "myoption=unknown");

            // Assert
            var notFound = Assert.IsType <NotFoundObjectResult>(result);

            notFound.Value.Should().Be("Option 'myoption' parameter 'unknown' not found.");
        }
コード例 #5
0
        private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            NewController ctrl = NewController.getInstance();

            if (e.ColumnIndex == 2)
            {
                //Actualiza proyecto
                OpenFileDialog file = new OpenFileDialog();
                if (file.ShowDialog() == DialogResult.OK)
                {
                    path = file.FileName;
                    using (WaitForm frm = new WaitForm(Actializar))
                    {
                        frm.ShowDialog(this);
                    }
                    System.Windows.Forms.MessageBox.Show("Proyecto actualizado correctamente");
                }
            }
            else if (e.ColumnIndex == 3)
            {
                //Abre poryecto
                Proyecto p = new Proyecto();
                p.id     = (string)dataGridView1.Rows[e.RowIndex].Cells[0].Value;
                p.nombre = (string)dataGridView1.Rows[e.RowIndex].Cells[1].Value;
                ctrl.getDTO().setProyecto(p);
                using (WaitForm frm = new WaitForm(AbrirPoyecto))
                {
                    frm.ShowDialog(this);
                }
                this.Hide();
                Form guiProyecto = new GUIProyecto();
                guiProyecto.ShowDialog();
                this.Show();
            }
        }
コード例 #6
0
 private void Awake()
 {
     playerController = GetComponentInParent <NewController>();
     trail            = GetComponentInChildren <TrailRenderer>();
     trailObject      = trail.gameObject;
     trailObject.SetActive(true);
 }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     anim       = GetComponent <Animator> ();
     controller = this.gameObject.transform.parent.GetComponent <NewController> ();
     prh        = transform.parent.GetComponent <PlayerRelicHandler> ();
     rb         = transform.parent.GetComponent <Rigidbody> ();
 }
コード例 #8
0
 private void TreeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node.Tag is Tarea)
     {
         gBEvidencias.Visible = false;
         Tarea t = (Tarea)e.Node.Tag;
         lNombreTarea.Text        = t.nombre;
         lEncargado.Text          = (t.encargado != null ? t.encargado.nombre : "Sin asignar");
         lFchEntrega.Text         = (t.fchEntrega != null ? t.fchEntrega.ToString("dd/MM/yyyy") : "Sin asignar");
         lNotas.Text              = (t.notas != null ? t.notas : "");
         btnAgregarAvance.Enabled = t.tareas.Count == 0;
     }
     else
     {
         btnAgregarAvance.Enabled = false;
         gBEvidencias.Visible     = true;
         Avance a = (Avance)e.Node.Tag;
         lNombreTarea.Text = "Avance";
         lEncargado.Text   = a.creador.nombre;
         lFchEntrega.Text  = a.Fecha.ToString("dd/MM/yyyy");
         lNotas.Text       = "Horas dedicadas: " + a.HorasDedicadas + "\n" + a.descripción;
         dataGridView1.Rows.Clear();
         foreach (Evidencia evidencia in a.evidencias)
         {
             dataGridView1.Rows.Add(a.id, a.creador.nombre, a.Fecha.ToString("dd/MM/yyyy"));
         }
         NewController.getInstance().dto.setAvance(a);
     }
 }
コード例 #9
0
        public async Task GetTemplateHelp_Should_Return_Help()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --help", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
Some helpful tips for you
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateHelp("mytemplate");

            // Assert
            var ok   = Assert.IsType <OkObjectResult>(result);
            var help = Assert.IsType <string>(ok.Value);

            help.Should().Be("Some helpful tips for you");
        }
コード例 #10
0
        public async Task GetTemplateProject_Can_Specify_Output()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Joe",
                                               It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
The template ""mytemplate"" was created successfully.
",
                Error    = "",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate", "output=Joe");

            // Assert
            var file = Assert.IsType <FileContentResult>(result);

            file.FileDownloadName.Should().StartWith("Joe.");
        }
コード例 #11
0
        public async Task GetTemplateProject_UnknownTemplate_Should_Return_NotFound()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c =>
                           c.ExecuteAsync($"{NetCoreTool.Command} new nosuchtemplate --output=Sample", It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 14,
                Error    = @"
No templates found matching: 'nosuchtemplate'.
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("nosuchtemplate");

            // Assert
            var notFound = Assert.IsType <NotFoundObjectResult>(result);

            notFound.Value.Should().Be("Template 'nosuchtemplate' not found.");
        }
コード例 #12
0
        public async Task GetTemplateProject_UnknownSwitch2_Should_Return_NotFound()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c =>
                           c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Sample --unknown-switch",
                                          It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 5,
                Error    = @"
Error: Invalid option(s):
--unknown-switch
   '--unknown-switch' is not a valid option
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate", "unknown-switch");

            // Assert
            var notFound = Assert.IsType <NotFoundObjectResult>(result);

            notFound.Value.Should().Be("Switch 'unknown-switch' not found.");
        }
コード例 #13
0
        public async Task GetTemplateProject_Can_Specify_ZipPackaging()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Sample",
                                               It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
The template ""mytemplate"" was created successfully.
",
                Error    = "",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate", packaging : "zip");

            // Assert
            var file = Assert.IsType <FileContentResult>(result);
            var _    = new ZipArchive(new MemoryStream(file.FileContents));
        }
コード例 #14
0
        public async Task UninstallTemplates_UnknownNuGet_Should_Return_NotFound()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
-------------------  --------  ---------  ---------
",
            }
                          );
            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --uninstall My.Templates", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
Could not find something to uninstall called 'My.Templates'.
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.UninstallTemplates("My.Templates");

            // Assert
            var notFound = Assert.IsType <NotFoundObjectResult>(result);

            notFound.Value.Should().Be("No templates with NuGet ID 'My.Templates' installed.");
        }
コード例 #15
0
 public void filtrar()
 {
     if (!NewController.getInstance().getDTO().getUsuario().isAdministrador)
     {
         vista.filtrar();
     }
 }
コード例 #16
0
 public GUIAvance()
 {
     InitializeComponent();
     limpiarTabla();
     controlador = NewController.getInstance();
     controlador.dto.setAvance(new Avance());
 }
コード例 #17
0
        public async Task GetTemplates_Should_Return_AllTemplates()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(expression: c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
-------------------  --------  ---------  ---------
My Template          myt       lang       tags
My Other Template    myot      otherlang  othertags
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplates();

            // Assert
            var okResult  = Assert.IsType <OkObjectResult>(result);
            var templates = Assert.IsType <TemplateDictionary>(okResult.Value);

            templates.Count.Should().Be(2);
            templates.Keys.Should().Contain("myt");
            templates["myt"].Name.Should().Be("My Template");
            templates["myt"].Languages.Should().Be("lang");
            templates["myt"].Tags.Should().Be("tags");
            templates.Keys.Should().Contain("myot");
            templates["myot"].Name.Should().Be("My Other Template");
            templates["myot"].Languages.Should().Be("otherlang");
            templates["myot"].Tags.Should().Be("othertags");
        }
コード例 #18
0
        public async Task GetTemplateProject_UnknownPackaging_Should_Return_BadRequest()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.Setup(c =>
                           c.ExecuteAsync($"{NetCoreTool.Command} new mytemplate --output=Sample --myoption=unknown",
                                          It.IsAny <string>(), -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = "",
                Error    = @"
Error: Invalid parameter(s):
--myoption unknown
    'unknown' is not a valid value for --myoption
",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.GetTemplateProject("mytemplate", packaging : "acme-packaging");

            // Assert
            var badRequest = Assert.IsType <BadRequestObjectResult>(result);

            badRequest.Value.Should().Be("Unknown or unsupported packaging 'acme-packaging'.");
        }
コード例 #19
0
        private void BtnAgregarAvance_Click(object sender, EventArgs e)
        {
            NewController.getInstance().getDTO().setTarea((Tarea)treeView1.SelectedNode.Tag);
            Form avance = new GUIAvance();

            avance.ShowDialog();
            LoadTreeView();
        }
コード例 #20
0
 private void TreeView1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Z && e.Modifiers == Keys.Control)
     {
         NewController.getInstance().undoAvance();
         LoadTreeView();
     }
 }
コード例 #21
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <PlayerController>();
     if (player == null)
     {
         player2 = FindObjectOfType <NewController>();
     }
 }
コード例 #22
0
 public GUIConsultas()
 {
     control = NewController.getInstance();
     InitializeComponent();
     btnConsultar.ForeColor = Color.White;
     btnReporte.ForeColor   = Color.White;
     loadProyectos();
 }
コード例 #23
0
ファイル: SniperRifle.cs プロジェクト: olcw78/Raid_Graduate
 protected override void Awake()
 {
     base.Awake();
     playerController = FindObjectOfType <NewController>();
     playerTransform  = GameObject.Find("Player").transform;
     playerCamera     = Camera.main.GetComponent <NewTPSCamera>();
     UiSwitchDelay    = WeaponSwitchDelay * 0.5f;
 }
コード例 #24
0
        private void LoadProyects()
        {
            dataGridView1.Rows.Clear();
            List <Proyecto> proyectos = NewController.getInstance().consultarProyectos();

            foreach (Proyecto p in proyectos)
            {
                dataGridView1.Rows.Add(p.id, p.nombre);
            }
        }
コード例 #25
0
ファイル: SniperRifle.cs プロジェクト: olcw78/Raid_Graduate
    protected override void Awake()
    {
        base.Awake();
        playerController = FindObjectOfType <NewController>();
        playerTransform  = GameObject.Find("LocalPlayer").transform;
        playerCamera     = Camera.main.GetComponent <NewTPSCamera>();
        UiSwitchDelay    = WeaponSwitchDelay * 0.5f;

        reloader = playerTransform.gameObject.AddComponent <AutoReloader>();
        reloader.SetWeapon(this);
        reloader.SetTimer(10.0f);
    }
コード例 #26
0
        private void loadComboBoxID()
        {
            NewController  ctrl = NewController.getInstance();
            List <Usuario> usrs = ctrl.consultarUsuarios();

            foreach (Usuario u in usrs)
            {
                cBID.Items.Add(u);
            }
            cBID.DisplayMember = "nombre";
            cBID.ValueMember   = "id";
        }
コード例 #27
0
        public async Task InstallTemplates_Should_Return_InstalledTemplates()
        {
            // Arrange
            var executor = new Mock <ICommandExecutor>();

            executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
-------------------  --------  ---------  ---------
My Template          myt       lang       tags
My Other Template    myot      otherlang  othertags
",
            }
                          )
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = @"
-------------------  --------  ---------  ----------
A New Template       ant       smalltalk  newstuff
My Template          myt       lang       tags
My Other Template    myot      otherlang  othertags
Other New Template   ont       bigtalk    otherstuff
",
            }
                          );
            executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --install My.Templates", null, -1))
            .ReturnsAsync(new CommandResult
            {
                ExitCode = 0,
                Output   = "",
            }
                          );
            var controller = new NewController(executor.Object);

            // Act
            var result = await controller.InstallTemplates("My.Templates");

            // Assert
            var createdResult = Assert.IsType <CreatedAtActionResult>(result);
            var templates     = Assert.IsType <TemplateDictionary>(createdResult.Value);

            templates.Count.Should().Be(2);
            templates["ant"].Name.Should().Be("A New Template");
            templates["ant"].Languages.Should().Be("smalltalk");
            templates["ant"].Tags.Should().Be("newstuff");
            templates["ont"].Name.Should().Be("Other New Template");
            templates["ont"].Languages.Should().Be("bigtalk");
            templates["ont"].Tags.Should().Be("otherstuff");
        }
コード例 #28
0
    public NewControllerTests()
    {
        var jsonOptions = TestHelpers.CreateJsonOptions();

        _memoryCache = TestHelpers.CreateTestMemoryCache();
        var httpContext = new DefaultHttpContext {
            TraceIdentifier = NewGameId
        };

        _controller = new NewController(Options.Create(jsonOptions), _memoryCache)
        {
            ControllerContext = { HttpContext = httpContext }
        };
    }
コード例 #29
0
ファイル: Program.cs プロジェクト: nats/castle-1.0.3-mono
		static void Main(string[] args)
		{
			AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

			MainOptions opts = new MainOptions();
			opts.ProcessArgs(args);

			if (args.Length == 0 || args[0].StartsWith("-"))
			{
				ShowUsage();
			}

			Console.WriteLine("Processing {0} {1}", args[0], opts.verbose);

			IGenerator generator = null;

			if (args[0] == "controller")
			{
				generator = new NewController();
			}
			else if (args[0] == "project")
			{
				generator = new NewProject();
			}
			else
			{
				Console.Error.WriteLine("Not supported");
				return;
			}

			Configure(generator, args);

			string workingDir = AppDomain.CurrentDomain.BaseDirectory;
			string templateDir = @"C:\dev\DotNet\castle\svn\trunk\MonoRail\NewGenerator\GeneratorTemplates\";

			GeneratorContext context = new GeneratorContext(workingDir, templateDir);

			ITemplateEngine engine = new NVelocityTemplateEngine(templateDir);

			if (engine is ISupportInitialize)
			{
				((ISupportInitialize)engine).BeginInit();
			}

			generator.Generate(context, new DefaultGeneratorService(context, engine));
		}
コード例 #30
0
        public void Execute(string[] args)
        {
            // allocate a new controller from command line arguments.
            using (var controller = NewController.FromArgs(ref args))
            {
                var nodeCount = args.Length == 2 ? Convert.ToInt32(args[0]) : 100000;
                var edgeCount = args.Length == 2 ? Convert.ToInt32(args[1]) : 200000;

                #region Generate a local fraction of input data

                var random        = new Random(0);
                var processes     = controller.Configuration.Processes;
                var graphFragment = new Pair <int, int> [edgeCount / processes];
                for (int i = 0; i < graphFragment.Length; i++)
                {
                    graphFragment[i] = new Pair <int, int>(random.Next(nodeCount), random.Next(nodeCount));
                }

                #endregion

                Console.WriteLine("Computing components of a random graph on {0} nodes and {1} edges", nodeCount, edgeCount);

                // allocate a new graph manager for the computation.
                using (var manager = controller.NewGraph())
                {
                    // convert array of edges to single-epoch stream.
                    var edges = graphFragment.AsNaiadStream(manager)
                                .Synchronize();

                    // symmetrize the graph by adding in transposed edges.
                    edges = edges.Select(x => new Pair <int, int>(x.v2, x.v1))
                            .Concat(edges);

                    edges.DirectedReachability()
                    .Subscribe(list => Console.WriteLine("labeled {0} nodes", list.Count()));

                    manager.Activate();     // start graph computation
                    manager.Join();         // block until computation completes
                }

                controller.Join();
            }
        }
コード例 #31
0
        private void attempt_log_in()
        {
            NewController ctrl = NewController.getInstance();

            ctrl.getDTO().getUsuario().id = tBCorreo.Text;
            if (ctrl.login())
            {
                this.Hide();
                ProxyVistaMain proxy = new ProxyVistaMain();
                Form           main  = proxy.vista;
                main.ShowDialog();
                tBCorreo.Text = "";
                this.Show();
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Error: usuario no existe");
            }
        }