Exemplo n.º 1
0
        static CustomBehavior()
        {
            Null = new CustomBehavior();

            Null.OnActivate(() => Task.CompletedTask);
            Null.OnDeactivate(() => Task.CompletedTask);
            Null.OnReceive((actor, message) => actor.Dispatch(message));
            Null.OnReminder((actor, id) =>
            {
                throw new NotImplementedException(
                    $"Override {nameof(Actor.OnReminder)}(string id) method in " +
                    $"class {actor.GetType()} to implement corresponding behavior");
            });

            const string warn = "Initial behavior has not been set";

            Null.OnBecome(() => { throw new InvalidOperationException(warn); });
        }