Introduction to open-source project Foq

Source: Internet
Author: User

Foq is a lightweight-thread-safe mocking class library. It is a common practice to use mock abstract classes and interfaces. The Foq name comes from Moq. If you have used Moq, you will naturally think of what it can do. Foq is mainly used for unit testing for developers of F. It can be used with FsUnit to write some Fluent assertions. It even simplifies unit test settings with AutoFixture.
// Moq from C #

var mock = new Mock<ILoveThisFramework>();
mock.Setup(framework => framework.DownloadExists("2.0.0.0"))
   .Returns(true);
ILoveThisFramework lovable = mock.Object;
 
 
// Foq from F#
let lovable = 
   Mock<ILoveThisFramework>()
      .Setup(fun framework -> <@ framework.DownloadExists("2.0.0.0") @>)
      .Returns(true)
      .Create()

 

Some DEMO references are also provided on CodePlex Official Website:

  • Greeting
  • Tea
  • Candy Shop
  • Driver
  • Car insurance
  • Turtle

     

    You can also visit its official website.

     

    Articles you may be interested in:
    Durandal Introduction
    CompositeC1 4 released

     

    Hope to help your software development.

    Author: Petter Liu
    Source: http://www.cnblogs.com/wintersun/
    The copyright of this article is shared by the author and the blog Park. You are welcome to repost this article. However, you must retain this statement without the author's consent and provide a clear link to the original article on the article page. Otherwise, you will be held legally liable.
    This article is also published in Petter Liu Blog, my independent Blog.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.