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