CreateAggregate() public method

public CreateAggregate ( string aggreagateId ) : IEventAggregate
aggreagateId string
return IEventAggregate
コード例 #1
0
 public void DuplicateCreateTest()
 {
     var repository = new AggregateRepository();
     var id = "testId";
     repository.CreateAggregate(id);
     repository.CreateAggregate(id);
 }
コード例 #2
0
        public void GetLastVersionsTest()
        {
            m_EventAggregate.SetupGet(m => m.LastVersion).Returns(123);
            var a = new AggregateRepository();
            var aggregate = a.CreateAggregate("1");

            var result = a.GetLastVersions();
            CollectionAssert.AreEquivalent(new[] { new KeyValuePair<string, int>("1", 123)}, result);
        }
コード例 #3
0
        public void CreateAndGetSuccessfullTest()
        {
            var repository = new AggregateRepository();
            var id = "testId";
            var aggregate = repository.CreateAggregate(id);

            IEventAggregate retrieved;
            Assert.IsTrue(repository.TryGetEventAggregate(id, out retrieved));
            Assert.AreEqual(aggregate, retrieved);
        }
コード例 #4
0
 public void GetAllIdsTest([Range(0, 2)]int count)
 {
     var a = new AggregateRepository();
     for (int i = 0; i < count; i++)
     {
         a.CreateAggregate(i.ToString());
     }
     var ids = a.GetAllIds();
     Assert.AreEqual(count, ids.Count);
     CollectionAssert.AreEquivalent(Enumerable.Range(0, count).Select(i => i.ToString()), ids);
 }