Beispiel #1
0
        public void Should_same_languages_if_removing_single_language()
        {
            var config_1 = config_0.Remove(Language.EN);

            Assert.Same(config_0, config_1);
        }
Beispiel #2
0
 public static LanguagesConfig Apply(this LanguagesConfig languagesConfig, AppLanguageRemoved @event)
 {
     return(languagesConfig.Remove(@event.Language));
 }
Beispiel #3
0
        public void ApplyEvent(IEvent @event)
        {
            switch (@event)
            {
            case AppCreated e:
            {
                Roles = Roles.CreateDefaults(e.Name);

                SimpleMapper.Map(e, this);

                break;
            }

            case AppUpdated e:
            {
                SimpleMapper.Map(e, this);

                break;
            }

            case AppImageUploaded e:
            {
                Image = e.Image;

                break;
            }

            case AppImageRemoved _:
            {
                Image = null;

                break;
            }

            case AppPlanChanged e:
            {
                Plan = AppPlan.Build(e.Actor, e.PlanId);

                break;
            }

            case AppPlanReset _:
            {
                Plan = null;

                break;
            }

            case AppContributorAssigned e:
            {
                Contributors = Contributors.Assign(e.ContributorId, e.Role);

                break;
            }

            case AppContributorRemoved e:
            {
                Contributors = Contributors.Remove(e.ContributorId);

                break;
            }

            case AppClientAttached e:
            {
                Clients = Clients.Add(e.Id, e.Secret);

                break;
            }

            case AppClientUpdated e:
            {
                Clients = Clients.Update(e.Id, e.Role);

                break;
            }

            case AppClientRenamed e:
            {
                Clients = Clients.Rename(e.Id, e.Name);

                break;
            }

            case AppClientRevoked e:
            {
                Clients = Clients.Revoke(e.Id);

                break;
            }

            case AppWorkflowAdded e:
            {
                Workflows = Workflows.Add(e.WorkflowId, e.Name);

                break;
            }

            case AppWorkflowUpdated e:
            {
                Workflows = Workflows.Update(e.WorkflowId, e.Workflow);

                break;
            }

            case AppWorkflowDeleted e:
            {
                Workflows = Workflows.Remove(e.WorkflowId);

                break;
            }

            case AppPatternAdded e:
            {
                Patterns = Patterns.Add(e.PatternId, e.Name, e.Pattern, e.Message);

                break;
            }

            case AppPatternDeleted e:
            {
                Patterns = Patterns.Remove(e.PatternId);

                break;
            }

            case AppPatternUpdated e:
            {
                Patterns = Patterns.Update(e.PatternId, e.Name, e.Pattern, e.Message);

                break;
            }

            case AppRoleAdded e:
            {
                Roles = Roles.Add(e.Name);

                break;
            }

            case AppRoleDeleted e:
            {
                Roles = Roles.Remove(e.Name);

                break;
            }

            case AppRoleUpdated e:
            {
                Roles = Roles.Update(e.Name, e.Permissions.Prefix(Name));

                break;
            }

            case AppLanguageAdded e:
            {
                LanguagesConfig = LanguagesConfig.Set(e.Language);

                break;
            }

            case AppLanguageRemoved e:
            {
                LanguagesConfig = LanguagesConfig.Remove(e.Language);

                break;
            }

            case AppLanguageUpdated e:
            {
                LanguagesConfig = LanguagesConfig.Set(e.Language, e.IsOptional, e.Fallback);

                if (e.IsMaster)
                {
                    LanguagesConfig = LanguagesConfig.MakeMaster(e.Language);
                }

                break;
            }

            case AppArchived _:
            {
                Plan = null;

                IsArchived = true;

                break;
            }
            }
        }
Beispiel #4
0
 protected void On(AppLanguageRemoved @event)
 {
     LanguagesConfig = LanguagesConfig.Remove(@event.Language);
 }
Beispiel #5
0
 public static void Apply(this LanguagesConfig languagesConfig, AppLanguageRemoved @event)
 {
     languagesConfig.Remove(@event.Language);
 }