Ejemplo n.º 1
0
        public void Deve_retornar_verdadeiro_quando_command_nao_preenchido()
        {
            var command = new CriarGitHubCommand();

            command.Validar();

            Assert.IsTrue(command.Notifications.Any());
        }
Ejemplo n.º 2
0
        public void Deve_retornar_verdadeiro_quando_command_preenchido_e_owner_nao_preenchido()
        {
            var command = new CriarGitHubCommand()
            {
                Full_Name   = "octocat/Hello-World",
                Description = "This your first repo!",
                Html_Url    = "https://github.com/octocat/Hello-World",
                Id          = 1296269,
                Name        = "Hello-World",
                Node_Id     = "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
                Updated_At  = ""
            };

            command.Validar();

            Assert.IsTrue(command.Notifications.Any());
        }
Ejemplo n.º 3
0
        public void Deve_retornar_falso_quando_command_preenchido()
        {
            var command = new CriarGitHubCommand()
            {
                Full_Name   = "octocat/Hello-World",
                Description = "This your first repo!",
                Html_Url    = "https://github.com/octocat/Hello-World",
                Id          = 1296269,
                Name        = "Hello-World",
                Node_Id     = "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
                Updated_At  = "2019-07-16",
                Created_At  = "2019-07-16",
                Pushed_At   = "2019-07-16",
                Language    = "CSharp",
                Owner       = new Owner("octocat", 1, "MDQ6VXNlcjE=", "https://github.com/images/error/octocat_happy.gif", "User", "https://api.github.com/users/octocat")
            };

            command.Validar();

            Assert.IsFalse(command.Notifications.Any());
        }
        public void Gravar(GitHubResponseResult gitHub)
        {
            foreach (var item in gitHub.Items)
            {
                var command = new CriarGitHubCommand()
                {
                    Full_Name   = item.Full_Name,
                    Description = item.Description,
                    Pushed_At   = item.Pushed_At,
                    Created_At  = item.Created_At,
                    Html_Url    = item.Html_Url,
                    Id          = item.Id,
                    Name        = item.Name,
                    Node_Id     = item.Node_Id,
                    Updated_At  = item.Updated_At,
                    Language    = item.Language,
                    Owner       = new Owner(item.Owner.Login, item.Owner.Id, item.Owner.Node_Id, item.Owner.Avatar_Url, item.Owner.Type, item.Owner.Url)
                };

                _handler.Handle(command);
            }
        }