草庐IT

default_test

全部标签

testing - 在小部件测试期间,如何 stub 不属于类的函数?

我正在创建一个flutter应用程序,它使用原生相机拍照,使用官方的flutter相机包(https://pub.dev/packages/camera)。该应用程序打开一个模式,该模式根据包中availableCameras函数的结果加载CameraPreview和拍摄照片的FloatingActionButton按下时。在为此模式创建小部件测试时,我不知道如何stubavailableCameras函数以在测试期间返回我想要的内容。我尝试使用Mockito测试包,但这只支持模拟类。由于此函数不属于某个类,因此我无法模拟它。availableCameras函数返回设备拥有的摄像头列表

testing - 在小部件测试期间,如何 stub 不属于类的函数?

我正在创建一个flutter应用程序,它使用原生相机拍照,使用官方的flutter相机包(https://pub.dev/packages/camera)。该应用程序打开一个模式,该模式根据包中availableCameras函数的结果加载CameraPreview和拍摄照片的FloatingActionButton按下时。在为此模式创建小部件测试时,我不知道如何stubavailableCameras函数以在测试期间返回我想要的内容。我尝试使用Mockito测试包,但这只支持模拟类。由于此函数不属于某个类,因此我无法模拟它。availableCameras函数返回设备拥有的摄像头列表

unit-testing - Fluent NHibernate - HiLo 方案的 PersistenceSpecification

不确定我问的问题是否正确,所以请多多包涵!一点NHibernate新手。我们正在使用FluentNH并且所有表都有以下id生成方案publicclassIdGenerationConvention:IIdConvention{publicvoidApply(IIdentityInstanceinstance){varwhere=string.Format("TableKey='{0}'",instance.EntityType.Name);instance.GeneratedBy.HiLo("HiloPrimaryKeys","NextHighValue","1000",x=>x.Ad

unit-testing - Fluent NHibernate - HiLo 方案的 PersistenceSpecification

不确定我问的问题是否正确,所以请多多包涵!一点NHibernate新手。我们正在使用FluentNH并且所有表都有以下id生成方案publicclassIdGenerationConvention:IIdConvention{publicvoidApply(IIdentityInstanceinstance){varwhere=string.Format("TableKey='{0}'",instance.EntityType.Name);instance.GeneratedBy.HiLo("HiloPrimaryKeys","NextHighValue","1000",x=>x.Ad

unit-testing - FluentNhibernate 和 SQLite

我无法让SQLite驱动程序在我的session工厂中工作。我从http://sqlite.phxsoftware.com/下载了SQLite1.0.48我在我的测试项目中添加了对System.Data.SQLite的引用。publicstaticIPersistenceConfigurerGetSqlLiteConfigurer(){try{returnSQLiteConfiguration.Standard.InMemory();}catch(Exceptionex){throwex;}}这就是我生成配置器的方式问题是当我构建session工厂时出现以下错误:NHibernate.

unit-testing - FluentNhibernate 和 SQLite

我无法让SQLite驱动程序在我的session工厂中工作。我从http://sqlite.phxsoftware.com/下载了SQLite1.0.48我在我的测试项目中添加了对System.Data.SQLite的引用。publicstaticIPersistenceConfigurerGetSqlLiteConfigurer(){try{returnSQLiteConfiguration.Standard.InMemory();}catch(Exceptionex){throwex;}}这就是我生成配置器的方式问题是当我构建session工厂时出现以下错误:NHibernate.

sqlite - Symfony2 : Unit testing with sqlite

我在Symfony2中使用phpunit。我决定使用sqlite进行测试。我遇到的问题是外键约束被忽略了。我知道我必须执行以下查询才能使用外键:PRAGMAforeign_keys=ON)。我的问题是:有没有办法在使用sqlite创建数据库模式时始终使用外键?谢谢! 最佳答案 不幸的是,这是不可能的。根据SQLitedocumentation:Assumingthelibraryiscompiledwithforeignkeyconstraintsenabled,itmuststillbeenabledbytheapplicatio

sqlite - Symfony2 : Unit testing with sqlite

我在Symfony2中使用phpunit。我决定使用sqlite进行测试。我遇到的问题是外键约束被忽略了。我知道我必须执行以下查询才能使用外键:PRAGMAforeign_keys=ON)。我的问题是:有没有办法在使用sqlite创建数据库模式时始终使用外键?谢谢! 最佳答案 不幸的是,这是不可能的。根据SQLitedocumentation:Assumingthelibraryiscompiledwithforeignkeyconstraintsenabled,itmuststillbeenabledbytheapplicatio

android - Android Studio 中的 "There is no default constructor available in android.database.sqlite.SQLitepenhelper"

尝试使用SQLiteOpenHelper扩展类,但出现此错误:“android.database.sqlite.SQLitepenhelper中没有可用的默认构造函数”以及其他“无法解析符号类别、注意、...”classDbHelperextendsSQLiteOpenHelper{@OverridepublicvoidonCreate(SQLiteDatabasedb){db.execSQL(Category.getSql());db.execSQL(Note.getSql());db.execSQL(Attachment.getSql());db.execSQL(CheckItem

android - Android Studio 中的 "There is no default constructor available in android.database.sqlite.SQLitepenhelper"

尝试使用SQLiteOpenHelper扩展类,但出现此错误:“android.database.sqlite.SQLitepenhelper中没有可用的默认构造函数”以及其他“无法解析符号类别、注意、...”classDbHelperextendsSQLiteOpenHelper{@OverridepublicvoidonCreate(SQLiteDatabasedb){db.execSQL(Category.getSql());db.execSQL(Note.getSql());db.execSQL(Attachment.getSql());db.execSQL(CheckItem