예제 #1
0
    public void DoStuffTest()
    {
        var myEvent           = new MyOneEvent();
        var myEventAggregator = Substitute.For <IEventAggregator>();

        myEventAggregator.GetEvent <OneEvent>().Returns(myEvent);
        var toBeTested = new ToBeTested(myEventAggregator);

        toBeTested.DoStuff();
        Assert.That(myEvent.ReceivedPayload, Is.EqualTo("test"));
    }
        public static void TestReturnErrorMessageInIsValid()
        {
            var attribute         = new ValidationAttributeOverrideTwoArgsIsValid();
            var toBeTested        = new ToBeTested();
            var validationContext = new ValidationContext(toBeTested);

            validationContext.MemberName = "PropertyToBeTested";
            var validationResult = attribute.GetValidationResult(toBeTested, validationContext);

            Assert.NotNull(validationResult); // validationResult == null would be success
                                              // cannot check error message - not defined on ret builds
        }
예제 #3
0
 public static void TestReturnErrorMessageInIsValid()
 {
     var attribute = new ValidationAttributeOverrideTwoArgsIsValid();
     var toBeTested = new ToBeTested();
     var validationContext = new ValidationContext(toBeTested);
     validationContext.MemberName = "PropertyToBeTested";
     var validationResult = attribute.GetValidationResult(toBeTested, validationContext);
     Assert.NotNull(validationResult); // validationResult == null would be success
                                       // cannot check error message - not defined on ret builds
 }
예제 #4
0
 public MyTests()
 {
     mockedClass = new Mock <MyInterface>();
     toBeTested  = new ToBeTested(mockedClass.Object);
 }