1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
17 namespace Castle
.Facilities
.NHibernateIntegration
.Tests
.Common
20 /// An implementation of the <see cref="IInterceptor"/> interface for testing
23 public class TestInterceptor
: EmptyInterceptor
25 private bool onSaveCall
;
26 private bool instantiationCall
;
28 public bool ConfirmOnSaveCall()
33 public bool ConfirmInstantiationCall()
35 return instantiationCall
;
38 public void ResetState()
40 instantiationCall
= false;
44 #region IInterceptor Members
46 public override int[] FindDirty(object entity
, object id
, object[] currentState
, object[] previousState
, string[] propertyNames
, NHibernate
.Type
.IType
[] types
)
51 public override object Instantiate(string clazz
, EntityMode entityMode
, object id
)
53 instantiationCall
= true;
57 public override bool OnFlushDirty(object entity
, object id
, object[] currentState
, object[] previousState
, string[] propertyNames
, NHibernate
.Type
.IType
[] types
)
62 public override bool OnLoad(object entity
, object id
, object[] state
, string[] propertyNames
, NHibernate
.Type
.IType
[] types
)
67 public override bool OnSave(object entity
, object id
, object[] state
, string[] propertyNames
, NHibernate
.Type
.IType
[] types
)
73 public override void OnDelete(object entity
, object id
, object[] state
, string[] propertyNames
, NHibernate
.Type
.IType
[] types
)
77 public override void PreFlush(System
.Collections
.ICollection entities
)
81 public override void PostFlush(System
.Collections
.ICollection entities
)