-
Notifications
You must be signed in to change notification settings - Fork 21
Home
Welcome to the Prig wiki!
Please see README.md!
Depending on a test case, you may think that "I want to call original method, and verify only the passed value", or "I want to just call indirectly at nth time". Prig provides the feature to call original method easily. For details, please see this page!
How do I hijack a generic type or a generic method? For details, please see this page!
The meaning of Profilers Chain is the feature that profilers are linked together and are run. You may think that "Are there any situation that links profilers together?". I believe it is yes. For details, please see this page!
Prig doesn't support the feature of traditional mocking frameworks, because I seem it can be done by just using them :)
Let me say the test for the following class:
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace TraditionalMockingFrameworkSample
{
public class NotifyingObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
int m_valueWithRandomAdded;
public int ValueWithRandomAdded
{
get { return m_valueWithRandomAdded; }
set
{
m_valueWithRandomAdded = value;
m_valueWithRandomAdded += new Random((int)DateTime.Now.Ticks).Next();
OnPropertyChanged();
}
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
var handler = PropertyChanged;
if (handler == null)
return;
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
I think you probably want to test that "ValueWithRandomAdded
should raise PropertyChanged
event with its name" or "ValueWithRandomAdded
should hold passed value + Random.Next()
". So, I will introduce combination examples to test with using Moq, NSubstitute, Rhino Mocks and FakeItEasy.
About combination examples of Moq. For details, please see this page!
About combination examples of NSubstitute. For details, please see this page!
About combination examples of Rhino Mocks. For details, please see this page!
About combination examples of FakeItEasy. For details, please see this page!
-
Home
- QUICK TOUR [SRC]
- FEATURES
- CHEAT SHEET
- PACKAGE MANAGER CONSOLE POWERSHELL REFERENCE
- COMMAND LINE REFERENCE
- APPVEYOR SUPPORT
- MIGRATION
- From Microsoft Research Moles [SRC]
- From Microsoft Fakes [SRC]
- From Telerik JustMock [SRC]
- From Typemock Isolator [SRC]