Ejemplo n.º 1
0
        public void Create_CreateDataImportFuncThrowsException_ExceptionIsPropogated()
        {
            var dataSource       = MockRepository.GenerateMock <IDataSource>();
            var dataImport       = MockRepository.GenerateMock <IDataImport>();
            var createDataImport = new Func <IDataSource, IDataImport>(ds => throw new InternalTestFailureException());

            var dataImportFactory = new DataImportFactory(createDataImport);

            dataImportFactory.Create(dataSource);
        }
Ejemplo n.º 2
0
        public void Create_DataSourceIsProvided_ExpectedDataImportIsReturned()
        {
            var dataSource       = MockRepository.GenerateMock <IDataSource>();
            var dataImport       = MockRepository.GenerateMock <IDataImport>();
            var createDataImport = new Func <IDataSource, IDataImport>(ds => ds.Equals(dataSource) ? dataImport : null);

            var dataImportFactory = new DataImportFactory(createDataImport);

            var returnedDataImport = dataImportFactory.Create(dataSource);

            Assert.AreEqual(dataImport, returnedDataImport);
        }