public void SetupTest() { this.sessionMock = new Mock<ISession>(); this.loggerMock = new Mock<ILog>(); this.factoryMock = new Mock<ISessionFactoryImplementor>(); this.factoryMock.Setup(f => f.GetCurrentSession()).Returns(this.sessionMock.Object); this.factoryMock.Setup(f => f.OpenSession()).Returns(this.sessionMock.Object); this.sessionMock.Setup(s => s.SessionFactory).Returns(this.factoryMock.Object); this.service = new UmaMasterDataService(this.factoryMock.Object) { Logger = this.loggerMock.Object }; var searchCountry = DbTestObject.UmaState(); searchCountry.StateId = 7774441; searchCountry.Label = "LEYPUTRIA_007"; searchCountry.ValidityEndDate = null; searchCountry.ValidityStartDate = null; var expiredCountry = DbTestObject.UmaState(); expiredCountry.Label = "EXPIRED_013"; expiredCountry.ValidityEndDate = RandomData.GetDateTimeInPast(); expiredCountry.ValidityStartDate = expiredCountry.ValidityEndDate.Value.AddYears(-1); List<UmaState> listOfCountries = new List<UmaState> { DbTestObject.UmaState(), searchCountry, expiredCountry }; NHibernateLinqExtension.TestableQueryable = session => listOfCountries.AsQueryable(); }
public void SetupTest() { this.sessionMock = new Mock<ISession>(); this.loggerMock = new Mock<ILog>(); this.factoryMock = new Mock<ISessionFactoryImplementor>(); this.factoryMock.Setup(f => f.GetCurrentSession()).Returns(this.sessionMock.Object); this.factoryMock.Setup(f => f.OpenSession()).Returns(this.sessionMock.Object); this.sessionMock.Setup(s => s.SessionFactory).Returns(this.factoryMock.Object); this.service = new UmaMasterDataService(this.factoryMock.Object) { Logger = this.loggerMock.Object }; var searchCode = DbTestObject.UmaCode(); searchCode.CodeId = 7774441; searchCode.Label = "SEARCH_CODE_LBL"; searchCode.ValidityEndDate = null; searchCode.ValidityStartDate = null; var expiredCode = DbTestObject.UmaCode(); expiredCode.Label = "EXPIRED_CODE"; expiredCode.ValidityEndDate = RandomData.GetDateTimeInPast(); expiredCode.ValidityStartDate = expiredCode.ValidityEndDate.Value.AddYears(-1); var umaCodeType = DbTestObject.UmaCodeType(); umaCodeType.CodeTypeId = 2357908; umaCodeType.Label = "TESTABLE_CDTPE"; umaCodeType.Codes.Add(searchCode); umaCodeType.Codes.Add(expiredCode); List<UmaCodeType> listOfCodeTypes = new List<UmaCodeType> { umaCodeType }; NHibernateLinqExtension.TestableQueryable = session => listOfCodeTypes.AsQueryable(); }
public void SetupTest() { this.sessionMock = new Mock<ISession>(); this.loggerMock = new Mock<ILog>(); this.factoryMock = new Mock<ISessionFactoryImplementor>(); this.factoryMock.Setup(f => f.GetCurrentSession()).Returns(this.sessionMock.Object); this.factoryMock.Setup(f => f.OpenSession()).Returns(this.sessionMock.Object); this.sessionMock.Setup(s => s.SessionFactory).Returns(this.factoryMock.Object); this.service = new UmaMasterDataService(this.factoryMock.Object) { Logger = this.loggerMock.Object }; }