コード例 #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>() }));
 }
コード例 #7
0
 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 }));
 }
コード例 #11
0
 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>()));
 }
コード例 #14
0
 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>()));
 }
コード例 #18
0
 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 }));
 }
コード例 #20
0
 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>())));
 }
コード例 #25
0
 public void IsEmpty_should_be_null_guarded()
 {
     NullGuardedConstraint.Assert(() =>
                                  CommonExtensions.IsEmpty(new List <string>()));
 }