Using Test Doubles with Unit Tests – PART 2

Getting back to the example, using the same repository and test that we outlined previously, we now convert that test to use a mock created by Moq instead of the repository stub. Listing below demonstrates how the code looks. using System; using System.Data.SqlClient; using Microsoft.Practices.Unity; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; namespace CodeSamples.Ch05_ClassMocking.Listing04 { public class MockingExample […]

Continue Reading

The Golden Rule of API Design

API DESIGN IS TOUGH, PARTICULARLY IN THE ENTERPRISE. If you are designing an API that is going to have hundreds or thousands of users, you have to think about how you might change it in the future and whether your changes might break client code. Beyond that, you have to think how users of your […]

Continue Reading

Continuously Integrate

HE BUILD AS A “BIG BANG” EVENT in project development is dead. The architect, whether an application or enterprise architect, should promote and encourage the use of continuous integration methods and tools for every project. The term continuous integration (CI) was first coined by Martin Fowler in a design pattern. CI refers to a set […]

Continue Reading

Database Sharding Pattern

This advanced pattern focuses on horizontally scaling data through sharding. To shard a database is to start with a single database and then divvy up its data across two or more databases (shards). Each shard has the same database schema as the original database. Most data is distributed such that each row appears in exactly […]

Continue Reading

Eventual Consistency Primer

The Eventual Consistency primer introduces eventual consistency and explains some ways to use it. This primer uses the CAP Theorem to highlight the challenges of maintaining data consistency across a distributed system and explains how eventual consistency can be a viable alternative. In an eventually consistent database, simultaneous requests for the same data value can […]

Continue Reading