Exemplo n.º 1
0
 public RequestCorrelationFeatureTests()
 {
     generator = A.Fake <IIdentityGenerator>();
     A.CallTo(() => generator.GenerateIdentity()).Returns(newId);
     feature = new RequestCorrelationFeature {
         IdentityGenerator = generator
     };
 }
 public RequestCorrelationFeatureTests(AppHostFixture fixture)
 {
     appHost   = fixture.AppHost;
     generator = A.Fake <IIdentityGenerator>();
     A.CallTo(() => generator.GenerateIdentity()).Returns(newId);
     feature = new RequestCorrelationFeature {
         IdentityGenerator = generator
     };
 }
Exemplo n.º 3
0
        /// <summary>
        /// Add the specified entity.
        /// </summary>
        /// <param name="entity">Entity.</param>
        /// <typeparam name="TEntity">The entity type.</typeparam>
        public override void Add <TEntity>(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (!entity.HasIdentity)
            {
                identityGenerator.GenerateIdentity(entity);
            }

            base.Add(entity);
        }