Skip to content

MohamedRadwan-DevOps/Dev-Magic-Fake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Abstraction 

DevMagicFake will enable us to save and retrieve any object of our domain model without writing any code, it stores and retrieves objects using memory. DevMagicFake also will enable us to generate objects with data, so no need to create any faked or mock object to simulate our application anymore, so by using DevMagicFake we can implement the concept of PI (Persistence Ignorance) of the DDD, by using DevMagicFake we don’t need to create DB or ORM to finish our application, by using DevMagicFake we can complete our application without writing the part of the persistence data, this will enable us to work toward verifying the business requirements and will give birth to real TDD, save our time and effort from writing faking and mocking code that we really don’t need it.

It is better to download the library using NuGet for the desired project, this will add the default configuration to the Web.config or the App.config.

NuGet  PM> Install-Package DevMagicFake

 

Let’s see some code snippet about some little features of DevMagicFake

Note: All domain model classes must be resident inside a class library project (Assembly) it's name is Domain and the main project add reference to it, this if you want to use the default configuration otherwise you need to change the assembly name in the configuration file

 

  • Generate 3 objects and generate its data for any class exists in our domain model assembly
var repository = new FakeRepository();
repository.GenerateDataForAllAssemblyTypes(3);

  • Get all objects for any type from our domain model, for example get all customers
var repository = new FakeRepository<Customer>();
var customerList = repository. GetAll();


  • Save any object of any type, for example create and save customer

 

    var customer = new Customer
                {
                    //Id = 1 -- No need, DevMagicFake will assign incremental Id per type, if it's new object
                    Name = "Mohamed Radwan",
                    Email = "[email protected]"
                };
var repository = new FakeRepository<Customer>();
repository.Save(customer);

 

  • Retrieve any aggregate root object by id like customer
var repository = new FakeRepository<Customer>();
var customer = repository.GetById(1);

  • Create faked objects from any type and generate their data, for example create 4 customer and generate its data
var repository = new FakeRepository<Customer>();
var customerList = repository.Create(4)

  • There are many other features that exist in DevMagicFake, for more information see the feature list and the tutorial

 

Project Description

DevMagicFake is a faking framework, it developed in C#, it enable developers to isolate the UI from the underline layers specially for MVC projects or any other project that use DDD or repository pattern, it gives developers the ability to focus on how to complete, verify and test the application behaviors and response without coding and without focus on developing the underline layers, until the application features completed, tested and approved

DevMagicFake developed mainly to work very well with ASP MVC web applications, but it can work as well with other applications.

DevMagicFake, give us the ability to implement TDD Test Driven Development through provide the right behaviors of the system which are the main input for test driven approach.

DevMagicFake can simulate the data model, so you don't need to create any CRUD by code, it's like data access application, it is working like the mock object in mocking framework with unit testing framework,

it provides Fakeable operations for all needed activities for developers in which allow them to run the system features as if they complete its programming, so that the feature can be tested by QC for functional requirements and can be verified by the client against the acceptance criteria and if it meets its requirements or not.

 

Links

 

The main goals of Dev Magic Fake are to give us the ability to:

  • Focus on what rather than focus on how
  • Provide real implementation of abstraction in software development
  • Implementing “Develop By Feature” approach by Agile methodology
  • Complete the feature without coding the underline layers
  • Give the ability to creating a passed successful unit testing to test the behavior and response of the application without completing the underline layers
  • Give the ability to creating a passed successful UI test to test the behavior and response of the UI without complete the underline layers
  • Create faking code with no effort
  • Create faking code in no time
  • Permanent data storage
  • Minimum effort for replacing the faking code with the real one

Dev Magic Fake not just code framework, Dev Magic Fake is a software development approach for the Agile methodology, Dev Magic Fake working better with TDD and MVC pattern

 

Dev Magic Fake Feature List

  • Easy implementation and usage without any prerequisite
  • Save any simple instance
  • Retrieve any instance of any type by Id
  • Save any complex instance (container of other instances) and retrieve its nested instance
  • Save any complex instance and save its nested instances
  • Save any complex instance (container of other instances) that has collection and retrieve it’s items
  • Save any complex instance that has a collection and save the collection items
  • Get all saved instances of any class
  • Generate instances for all classes in an assembly and generate it’s data
  • Generate instances for all classes that saved
  • Use the default data generation mechanism
  • Control the data generation mechanism using Range
  • Control the data generation mechanism using data types
  • Control the data generation that just included in specific assembly
  • Control the data generation that just included in specific namespace
  • Control the data generation that just marked with Fakeable attribute
  • Control the data generation to eliminate any type marked with NotFakeable attribute
  • Control the data generation for the depth of the object graph
  • Create any instance of any type and generate its data
  • Create list of instance of any type and generate its data
  • Provide permanent saved data for all saved instances
  • Easily query Dev Magic Fake using LINQ
  • Fluent interface for configuration and data generation

Dev Magic Fake Road Map and Upcoming Features

  • Support data generation based on data annotation
  • Support data generation based on regular expression
  • Support data generation based on database tables
  • Support many to many types in an effective and better way
  • Support custom collection
  • Support random enumeration
  • Using UI for configuration
  • Eliminate or reduce the maintainability of the faking code by using DI (Dependency Injection) and IoC (Inversion of Control).

 

Founder and creator

Dev Magic Fake authored and created by M.Radwan

http://mohamedradwan.com

Thanks

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages