Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tasty, versatile, nutritious; goes with many things in .net.

License

NotificationsYou must be signed in to change notification settings

fluffynuts/PeanutButter

Repository files navigation

Test status

Nuget current version badge

Download stats

Nuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badgeNuget downloads badge

Go to documentation

"Some tastiness to add to your dev sandwich"

PeanutButter is a collection of projects which provide usefulbits of functionality that I've often had to re-use (and alsoprovides some concrete examples of usage). Sometimes I can evenbe bothered to write about it athttp://davydm.blogspot.co.za/search/label/PeanutButter.

Inside, you'll find, amongst other things:

  • Duck-typing for .NET (PeanutButter.DuckTyping)
    • rigid or fuzzy duck-typing, including the abilityto wrap a dictionary with a strongly-typed interface,even if the starting dictionary is empty.
  • Randomisation utilities for testing with (PeanutButter.RandomGenerators)
    • Random Value Generators
      • Tests with random values are usually more useful because,if nothing else, after many runs, you've hit many testscenarios and often an edge case which would cause youproduction headaches pops out of the wood work. I preferto test with random values wherever possible
      • In addition to the helpers in RandomValueGen which canbe used to get randomised:
        • string values (arbitrary, alphabetic, or alphanumeric)
        • numeric values (decimal, long)
        • boolean values
        • datetime valuesthere is also the GenericBuilder base which you can useas a very quick and easy way to create builders forcomplex types. These builders have the ability to generaterandomised or directed objects.
  • Test utilities:
    • PeanutButter.TestUtils.Generic which allows easy TestCasescenarios for property get/set tests with PropertyAssertwhich allows easy comparison of properties by name or, indeedrelative path from the objects provided
    • PeanutButter.TestUtils.MVC (sunset) which provides a JsonResultExtensionsclass to simplify testing MVC actions which return JsonResults
    • PeanutButter.MVC (sunset), which provides facades and interfaces to makescript and style bundles testable
    • PeanutButter.TestUtils.Entity provides mechanisms for testingyour EF-based project code against temporary databasesso you can be sure that the code you deploy will work as expected.This library is supported by PeanutButter.TempDb, so you can test(out of the box) against LocalDb, Sqlite and SQLCE. You can alsoprovide your own TempDb<> implmentation
  • Arbitrary utils
    • DecimalDecorator which provides relatively safe string/decimalinterchange, irrespective of culture
    • XElementExtensions to make dealing with XElement text easier
  • On-the-fly HTTP server for testing when you simply need a WebRequestto work
  • TempDb implementations (LocalDb, SqlCe and Sqlite) so you can runtests which involve migrations and integration between your ORMand the actual db
  • WindowsServiceManagement
    • provides functionality for query of & interaction with win32services using the native Win32 api, exposed in an easy-to-useC# POCO
  • PeanutButter.DatabaseHelpers
    • provides builders for Select, Update, Delete and Insert SQLstatements for legacy projects where you can't (at least, notyet) get in an ORM. The builders are more testable and you canuse compile-time constants for table/column names to help toharden your code against dev errors and code rot
    • provides OleDB database executors and a data reader builder
  • PeanutButter.ServiceShell
    • provides scaffolding for a polling win32 service: inheritfrom the ServiceShell class, configure name and intervaland provide your custom logic in the RunOnce override
    • resultant services can install and uninstall themselves aswell as be invoked for once-off runs from the commandline.The project also contains a simple, but effective log4netconfiguration for console and a log file
  • EmailSpooler.Win32Service
    • harnesses PeanutButter.ServiceShell to provide a genericSMTP email spooling service backed with a data store. Youcan (theoretically) use any database which Entity can connectto, though this project has only been tested against MSSQL
    • EmailSpooler.Win32Service.DB provides FluentMigrator andraw SQL script files for generating the required underlyingdata structures.

Barring the last item, none of these are stand-alone: they're alljust building blocks which I've had to repeat and refine, so Ifigure they may be of use to others. As far as possible, the codeshould be under test, though some projects are more difficult tounit test (eg the PeanutButter.WindowsServiceManagement project,which was developed TDD-style but which would sometimes flake outon tests because the windows service management would be hit too hardor often. But it does work (:) And some are libraries to help withtesting, so you'll soon find that they work as expected.

A shout out to:

Jetbrains Logo

The work on PeanutButter would have been a lot more effort withoutRider from JetBrains. The good people at JetBrains have providedfree licensing for all of their products for open-source projects likethis one. To learn more about JetBrains products, please [visit them](http://jetbrains.com)

About

Tasty, versatile, nutritious; goes with many things in .net.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors14


[8]ページ先頭

©2009-2025 Movatter.jp