public void CreateCompetition_ReturnsNewCompetition()
        {
            //assert
            _teamServiceMock.Setup(x => x.GetTeams()).Returns(new List <Team> {
                new Team("Foo", 1, 1)
            });
            var expectedName = "Foo";

            //act
            var actual = _target.CreateCompetition(expectedName);

            //assert
            Assert.NotNull(actual);
            Assert.Equal(expectedName, actual.Name);
        }
        private void ButtonSaveCompetition_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(TextBoxCompetitionName.Text) || TextBoxCompetitionName.Text.Length < 3)
            {
                NotificationHelper.notifier.ShowCustomMessage("Nome da competição inválido!");
                return;
            }

            if ((SeasonComboModel)ComboBoxSeason.SelectedValue == null)
            {
                NotificationHelper.notifier.ShowCustomMessage("Falta escolher a época!");
                return;
            }

            if (competitionService.AlreadyExistsCompetition(TextBoxCompetitionName.Text, ((SeasonComboModel)ComboBoxSeason.SelectedValue).SeasonId))
            {
                NotificationHelper.notifier.ShowCustomMessage("Já existe uma competição idêntica!");
                return;
            }

            string compName = TextBoxCompetitionName.Text;
            int    seasonID = ((SeasonComboModel)ComboBoxSeason.SelectedValue).SeasonId;

            new Thread(() =>
            {
                UtilsNotification.StartLoadingAnimation();

                //Save new competition
                if (competitionService.CreateCompetition(compName, seasonID))
                {
                    NotificationHelper.notifier.ShowCustomMessage("Competição criada com sucesso!");

                    //Reset UI
                    TextBoxCompetitionName.Dispatcher.BeginInvoke((Action)(() => TextBoxCompetitionName.Clear()));

                    LoadCompetitionsGrid();
                }
                else
                {
                    NotificationHelper.notifier.ShowCustomMessage("Ocorreu um erro ao criar a Competição!");
                }

                UtilsNotification.StopLoadingAnimation();
            }).Start();
        }