Example #1
0
        public void UpdateWithIdentity_can_populate_an_entity_with_an_identity([Frozen] IGeneratesNumbers generator, InMemoryIdentityGenerator sut)
        {
            Mock.Get(generator).Setup(x => x.GetLong()).Returns(5L);
            var entity = new Car();

            sut.UpdateWithIdentity(entity);
            Assert.That(entity.Identity, Is.EqualTo(5L));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InMemoryIdentityGenerator"/> class.
 /// </summary>
 /// <param name="numberGenerator">A number generator service.</param>
 public InMemoryIdentityGenerator(IGeneratesNumbers numberGenerator = null)
 {
     this.numberGenerator = numberGenerator ?? DefaultGenerator;
 }