首页 \ 问答 \ 存储库本身通常不会被测试?(The repository itself is not usually tested?)

存储库本身通常不会被测试?(The repository itself is not usually tested?)

我很抱歉,但我对存储库模式,单元测试和orm工具很陌生。

我一直在研究单元测试和存储库模式,并得出一些结论,我想知道我是否正确。

存储库模式有助于单元测试在使用它的控制器中被替换,对吗? 因为创建上下文(在EF中)或会话(在NH中)的存根/假更难,对吗? 储存库本身没有经过测试? 为什么?

使用EntityFramework或NHibernate与存储库模式,如果我想测试我的存储库,我需要做集成测试? 因为如果我使用我的上下文/会话的假实现,我没有做真正的测试? 因为上下文/会话本身就是存储库(我的意思是它们实现了添加,删除,编辑,GetById,GetAll等的真实逻辑)?

EF或NH存储库模式就像一个包装? (不仅是一个包装,我知道这是一个域的导入概念。)


I'm sorry but I'm new to repositories patterns, unit tests and orm tools.

I've been researching on unit tests and the repository pattern, and arrived at some conclusions, I wonder if I'm right.

The repository pattern facilitates unit testing to be replaced in controller that make use of it for example, right? Because create a stub/fake of context(in EF) or session(in NH) is harder, right? The repository itself is not tested? Why?

Using EntityFramework or NHibernate with repository pattern, if i want to test my repositories I need to do integration tests? Because if I use a fake implementation of my context/session I'm not doing real tests? Because the context/session itself is the repository (I mean they implement the real logic of Add, Remove, Edit, GetById, GetAll, ..)?

The repository pattern with EF or NH is like a wrapper? (Not only a wrapper, I know this is a import concept of the domain.)


原文:https://stackoverflow.com/questions/7110981
更新时间:2021-11-27 11:11

最满意答案

我这样做了:

http://sourceforge.net/projects/pywebtool/

您可以获得任意数量的网页/编织产品,这些产品将帮助您一举构建文档和代码。

你可以 - 很容易 - 写你自己的。 从RST源码中抽取Python代码块并将其组装起来并不是一种火箭科学。 事实上,我建议你编写自己的Docutils指令来汇编RST源文档中的Python代码。

您通过docutils rst2html(或Sphinx)运行RST以生成最终的HTML报告。

您可以在同一RST源代码上运行自己的实用程序来提取Python代码块并生成最终模块。


I did this:

http://sourceforge.net/projects/pywebtool/

You can get any number of web/weave products that will help you construct a document and code in one swoop.

You can -- pretty easily -- write your own. It's not rocket science to yank the Python code blocks out of RST source and assemble it. Indeed, I suggest you write your own Docutils directives to assemble the Python code from an RST source document.

You run the RST through docutils rst2html (or Sphinx) to produce your final HTML report.

You run your own utility on the same RST source to extract the Python code blocks and produce the final modules.

相关问答

更多
  • 我这样做了: http://sourceforge.net/projects/pywebtool/ 您可以获得任意数量的网页/编织产品,这些产品将帮助您一举构建文档和代码。 你可以 - 很容易 - 写你自己的。 从RST源码中抽取Python代码块并将其组装起来并不是一种火箭科学。 事实上,我建议你编写自己的Docutils指令来汇编RST源文档中的Python代码。 您通过docutils rst2html(或Sphinx)运行RST以生成最终的HTML报告。 您可以在同一RST源代码上运行自己的实用程序 ...
  • 如果你真的想学习底层API,那么你应该从没有一个框架开始。 按照我们在Charles Petzold的“编程Windows”一书中几年前所做的那样学习它。 关于窗口和消息如何工作的知识基础非常好,可以很好地为您服务。 从长远来看,一个好的框架,例如WinForms,Qt,VCL等将会提高生产力。 但是如果你从其中一个开始,那么你就有可能不知道发送和排队消息之间的区别,不知道HWND , HDC和HANDLE之间的区别等等。 一个好的框架非常棒,但如果你了解它下面的内容,你就会从中获得更多。 If you a ...
  • C ++应该没问题。 我认为他最好学习内存管理,指针等知识。在跳到C#之前,他会理解程序如何更好地工作。 否则,他只会将记忆看作是魔法,垃圾收集器将没有真正的意义。 对底层语言(C,C ++,汇编等)产生最好的代码有很好的理解总是好的。 C++ should be fine. I think he is best off learning about memory management, pointers, etc. BEFORE jumping up to C# as he will understand ...
  • 我以前写了很多文字程序 。 你写什么作为Haddock的评论,你在写作部分写什么? 外部API文档进入Haddock注释。 一切都进入识字部分。 “其他”可能包括: 数据结构的内部不变量 为什么你这样做的事情 代码的设计是什么 为什么选择这种设计,还有其他设计被尝试和发现想要的 如何将识字编程扩展到多个文件? 同样的方式,您可以将大型LaTeX文档扩展到多个文件:每个模块一个文件,然后是一个巨大的文件, \include所有文件。 任何人都可以指出一个在多个模块的包中使用识字编程的例子? 它不是Haskel ...
  • 它不是一本古典意义上的书,但它对于Windows API(涵盖所有新的Windows 7技术)和规范性MSDN非常好,非常全面。 It is not a book in the classical sense, but it is great, extremely comprehensive when it comes to the Windows API (all new Windows 7 technologies are covered), and normative: MSDN.
  • 当你点击Combine ,你想查找确切运行的命令行等效项,假设它是c:\program files\adobe\combiner ... 您希望构建此字符串(将文件列表作为... )并执行它。 子进程模块中的Popen将执行此操作。 import subprocess cmd = [r"c:\program files\adobe\combiner"] cmd.extend(file_list) p = subprocess.Popen(cmd) 看看那个链接虽然,Popen需要很多论点,这只是最简单的形 ...
  • 如果你从头开始,并没有任何经验,我建议看看JavaFX 。 它是Oracle的声明式用户界面,类似于XAML和Flex。 我相信它最终会超过AWT,Swing和SWT。 虽然Swing在使用Java时可能很常见,但通常会导致缓慢且庞大的用户体验。 我不能建议使用Swing。 为什么选择JavaFX 用户界面是声明式的; 您不必编写Java代码。 这允许构建一些非常好的用户界面构建器,因为它可以在不必编译或处理Java的情况下处理UI。 用户界面很容易与业务逻辑分离,从而可以分离关注点和范例,如MVVM,MV ...
  • (我假设你正在使用Donald Knuth对文字编程的定义。) 关键区别在于序列之一 。 在编写常规应用程序时,对表达内容的顺序有限制。 为了显示: 特定类的所有代码都必须在一个地方表达 (或在极少数地方,例如C#部分类) 一个方法的所有代码必须一次性给出,执行顺序正确 必须在依赖于它们的事物之前声明依赖关系 (在大多数语言中使用之前声明的变量;在Pascal中使用之前声明的过程/函数;在.NET之前编译的库程序集) 通过文化编程,您可以摆脱这种限制,并在向其他开发人员解释程序时,以任何有意义的顺序表达您的 ...
  • 自然语言编程是用于以接近人类书写或说话的语言的形式向计算机表达指令的系统。 NLP语法结构通常类似于人类语言句子结构,其形式可能听起来像母语者,但往往几乎像真实语言一样阅读。 许多NLP实现都专注于查询数据存储而不是编写程序,但实际的编程实现也存在。 文学编程是一种用于同时编写程序和编写程序的系统。 与NLP不同,文学程序的代码部分是用传统的编程语言编写的。 Donald Knuth关于TeX排版系统的着作是经典的例子,其名称来源于此。 作为他的计算机和排版系列出版,印刷书籍是使用一种工具处理他的TeX文学 ...
  • 这应该很容易实现 :set formatoptions+=ro 或者:se fo+=ro 。 使用'formatoptions' r和o ,Vim会尝试在注释中的新行上插入注释“leader”,包括缩进(即,在文字Haskell中的非注释)。 要自动进行此设置,请在vimrc中设置自动命令。 autocmd FileType lhaskell setlocal formatoptions+=ro 提示:如果不需要,请使用CTRL-U删除自动插入的引导程序。 This should be easy to ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)