Tuesday, April 9, 2013

Moq Framework for Unit Testing

 

 

Properties of a good Unit Test

  1. Atomic : A unit test should test a small piece of functionality
  2. Deterministic : A unit test should always either pass or fail.
  3. Repeatable: A test is repeatable when it passes consitently. If a test passes and fails without changing the test or any of the dependent code is not repeatable.
  4. Order independent and Isolated – A test should not be dependent on any other test.
  5. Fast: if a test is taking 1 second to run it is slow. It should take milisecond.
  6. Easy to Setup

 

image

A mocking framework replaces these dependencies with Fake copies of dependencies:

image

Hand rolled Mock Objects:

Fake implementations of abstractions

Used to verify class interactions in automated tests.

Created by hand writing code

Creating hand rolled mocks:

  1. Basic class
  2. Implement the dependency interface type
  3. Flush out the dependency functionality needed
    1. Return Values
    2. Exception throwing
    3. “was it called?”
    4. “How many times it called?”

AAA Syntax (Arrange Act and Assert)

Arrange

Create a mock object

Act

Execute the SUT (System under test)

Assert

Verify SUT’s interaction with the mock object

Saturday, April 6, 2013

Thunderbird - setting an email account

Once you install Mozilla Thunderbird you can set your email account.

0. Open Thunderbird and cancel whatever is coming.
1. Go to Tools menu -> Account Settings  (If tools menu is not visible press Alt +T)
2. Click Account Actions -> Add Email Account

3. Put your credentials here and press continue.

4. Press Manual Config (dont worry if it is still precessing. just click on Manual config button) and do the following setting:

5. Press Re-test button and wait till following message comes:

6. Press done once and let it do check password checking.
7. Finally your inbox is downloading your emails.
8. You can attach your number of email accounts this way by doing the same process.
Even Yahoo, gmail can be done this way.