Пример #1
0
        public void PrepareIds()
        {
            var guid = Guid.NewGuid().ToString();

            Id  = new CounterId(guid);
            Id2 = new CounterId(guid);
        }
Пример #2
0
        public void CompareIds()
        {
            Assert.IsTrue(Id == Id2);
            Assert.IsFalse(Id != Id2);

            Assert.IsFalse(Id == null);
            Assert.IsTrue(Id != null);

            Id = null;
            Assert.IsTrue(Id == null);
        }
Пример #3
0
        public void Setup()
        {
            var serviceProvider = new ServiceCollection()
                                  .AddLogging()
                                  .BuildServiceProvider();

            var logger   = serviceProvider.GetService <ILogger <Repository <TestCounter, string> > >();
            var settings = new MongoDbSettings(MongoDefaultSettings.ConnectionString, "Tests");

            context    = new MongoDbContext(settings);
            repository = new Repository <TestCounter, string>(context, settings, logger);
            id         = TypedId.GetNewId <CounterId>();
            repository.InsertNewAsync(TestCounter.Create(id.Value, 0)).GetAwaiter().GetResult();
        }
Пример #4
0
 public CounterCreatedEvent(CounterId counterId, int value)
 {
     this.counterId = counterId;
     this.value     = value;
 }
Пример #5
0
 public TestCounter(CounterId counterId, int value)
 {
     this.Id           = counterId;
     this.CounterValue = value;
     AddEvent(new CounterCreatedEvent(counterId, value));
 }