예제 #1
0
        public void CallTo_with_void_call_should_be_null_guarded()
        {
            // Arrange
            var foo = A.Fake <IFoo>();

            // Act

            // Assert
            NullGuardedConstraint.Assert(() =>
                                         A.CallTo(() => foo.Bar()));
        }
예제 #2
0
 public void Assert_should_be_null_guarded()
 {
     try
     {
         NullGuardedConstraint.Assert(null);
         Assert.Fail("Exception should be thrown.");
     }
     catch (ArgumentNullException ex)
     {
         Assert.That(ex.ParamName, Is.EqualTo("call"));
     }
 }
예제 #3
0
 public void GetCalls_is_properly_guarded()
 {
     NullGuardedConstraint.Assert(() => Fake.GetCalls(A.Fake <IFoo>()));
 }
예제 #4
0
        public void Constructor_that_takes_method_is_properly_null_guarded()
        {
            var method = typeof(IFoo).GetMethod("Bar", new[] { typeof(object), typeof(object) });

            NullGuardedConstraint.Assert(() => new ArgumentCollection(new object[] { "foo", 1 }, method));
        }
예제 #5
0
 public void Fake_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  Configure.Fake(A.Fake <IFoo>()));
 }
예제 #6
0
 public void Constructor_that_takes_arguments_for_constructor_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new Fake <Foo>(new object[] { A.Fake <IServiceProvider>() }));
 }
 public void Constructor_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new CallCollection <IFoo>(new FakeObject(), x => (ExpressionCallMatcher)null));
 }
예제 #8
0
 public MethodCallConstraintState(MethodCallExpression expression)
     : base(GetExpressionArguments(expression))
 {
     this.method = expression.Method;
     this.target = NullGuardedConstraint.GetValueProducedByExpression(expression.Object);
 }
예제 #9
0
 public void SetUp()
 {
     this.constraint = new NullGuardedConstraint();
     this.writer     = new TextMessageWriter();
 }
예제 #10
0
 public void Fake_with_arguments_for_constructor_should_be_properly_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  A.Fake <IFoo>(new object[] { "foo", 1 }));
 }
 public void Setup()
 {
     this.constraint = new NullGuardedConstraint();
     this.writer = new TextMessageWriter();
 }
예제 #12
0
 public void WriteCalls_should_throw_when_calls_is_null()
 {
     NullGuardedConstraint.Assert(() =>
                                  FakeExtensions.Write(Enumerable.Empty <IFakeObjectCall>(), A.Dummy <IOutputWriter>()));
 }
예제 #13
0
 public void Write_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  Enumerable.Empty <IFakeObjectCall>().Write(A.Dummy <IOutputWriter>()));
 }
 public void Constructor_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new FakeObjectFactory(this.container));
 }
예제 #15
0
 public void Assert_should_delegate_to_constraint()
 {
     Assert.Throws <AssertionException>(() =>
                                        NullGuardedConstraint.Assert(() => UnguardedMethod("foo")));
 }
예제 #16
0
 public void Fake_with_wrapped_instance_and_recorder_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  A.Fake <IFoo>(A.Fake <IFoo>(), A.Fake <ISelfInitializingFakeRecorder>()));
 }
예제 #17
0
 public void Fake_with_wrapper_should_be_guarded_correctly()
 {
     NullGuardedConstraint.Assert(() => A.Fake(A.Fake <IFoo>()));
 }
 public void Pairwise_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  CommonExtensions.Zip(new List <string>(), new List <string>()));
 }
예제 #19
0
 public void Fake_with_arguments_for_constructor_should_be_properly_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  A.Fake <AbstractClassWithNoDefaultConstructor>(new object[] { "foo", 1 }));
 }
 public void ReturnsNull_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  FakeExtensions.ReturnsNull(A.Fake <IReturnValueConfiguration <IFoo, string> >()));
 }
예제 #21
0
 public void To_should_be_properly_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  NextCall.To(A.Fake <IFoo>()));
 }
예제 #22
0
 public void Constructor_that_takes_wrapped_instance_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new Fake <IFoo>(A.Fake <IFoo>()));
 }
예제 #23
0
 public void Constructor_is_properly_guarded()
 {
     NullGuardedConstraint.Assert(() => new ArgumentCollection(new object[] { "foo", 1 }, new[] { "foo", "bar" }));
 }
예제 #24
0
 public void Constructor_that_takes_constructor_expression_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new Fake <Foo>(() => new Foo(A.Fake <IServiceProvider>())));
 }
 public void IsEmpty_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  CommonExtensions.IsEmpty(new List <string>()));
 }