public void CallTo_with_void_call_should_be_null_guarded()
        {
            // Arrange
            var foo = A.Fake <IFoo>();

            // Act

            // Assert
            NullGuardedConstraint.Assert(() =>
                                         A.CallTo(() => foo.Bar()));
        }
Beispiel #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"));
     }
 }
 public void GetCalls_is_properly_guarded()
 {
     NullGuardedConstraint.Assert(() => Fake.GetCalls(A.Fake <IFoo>()));
 }
        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));
        }
Beispiel #5
0
 public void Fake_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  Configure.Fake(A.Fake <IFoo>()));
 }
Beispiel #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));
 }
 public MethodCallConstraintState(MethodCallExpression expression)
     : base(GetExpressionArguments(expression))
 {
     this.method = expression.Method;
     this.target = NullGuardedConstraint.GetValueProducedByExpression(expression.Object);
 }
Beispiel #9
0
 public void SetUp()
 {
     this.constraint = new NullGuardedConstraint();
     this.writer     = new TextMessageWriter();
 }
Beispiel #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();
 }
Beispiel #12
0
 public void WriteCalls_should_throw_when_calls_is_null()
 {
     NullGuardedConstraint.Assert(() =>
                                  FakeExtensions.Write(Enumerable.Empty <IFakeObjectCall>(), A.Dummy <IOutputWriter>()));
 }
Beispiel #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));
 }
Beispiel #15
0
 public void Assert_should_delegate_to_constraint()
 {
     Assert.Throws <AssertionException>(() =>
                                        NullGuardedConstraint.Assert(() => UnguardedMethod("foo")));
 }
Beispiel #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>()));
 }
Beispiel #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>()));
 }
Beispiel #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> >()));
 }
Beispiel #21
0
 public void To_should_be_properly_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  NextCall.To(A.Fake <IFoo>()));
 }
Beispiel #22
0
 public void Constructor_that_takes_wrapped_instance_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  new Fake <IFoo>(A.Fake <IFoo>()));
 }
 public void Constructor_is_properly_guarded()
 {
     NullGuardedConstraint.Assert(() => new ArgumentCollection(new object[] { "foo", 1 }, new[] { "foo", "bar" }));
 }
Beispiel #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>()));
 }