mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Squidex.Infrastructure.Commands;
|
|
using Squidex.Infrastructure.EventSourcing;
|
|
|
|
namespace Squidex.Infrastructure.TestHelpers
|
|
{
|
|
public sealed class MyDomainState : IDomainState<MyDomainState>
|
|
{
|
|
public const long Unchanged = 13;
|
|
|
|
public long Version { get; set; }
|
|
|
|
public long Value { get; set; }
|
|
|
|
public MyDomainState Apply(Envelope<IEvent> @event)
|
|
{
|
|
var value = @event.To<ValueChanged>().Payload.Value;
|
|
|
|
if (value == Unchanged)
|
|
{
|
|
return this;
|
|
}
|
|
|
|
return new MyDomainState { Value = value };
|
|
}
|
|
}
|
|
|
|
public sealed class ValueChanged : IEvent
|
|
{
|
|
public long Value { get; set; }
|
|
}
|
|
}
|
|
|