public void DuplicateCreateTest() { var repository = new AggregateRepository(); var id = "testId"; repository.CreateAggregate(id); repository.CreateAggregate(id); }
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); }
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); }
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); }