コード例 #1
0
		public void WhenNotCalled ()
		{
			IModelRepository mock = MockRepository.GenerateMock<IModelRepository> ();

			var modelCreator = new ModelCreator (mock);
			var theModel = new AnotherModel () { FieldA = 1, FieldB = "Test" };

			modelCreator.CreateModel (theModel);

			mock.AssertWasNotCalled (p => p.Add (Arg<AnotherModel>.Is.Null));       
		}
コード例 #2
0
		public void WhenArgumentIsAnything ()
		{
			IModelRepository mock = MockRepository.GenerateMock<IModelRepository> ();

			var modelCreator = new ModelCreator (mock);
			var theModel = new AnotherModel () { FieldA = 1, FieldB = "Test" };

			mock.Expect (p => p.Add (Arg<AnotherModel>.Is.Anything));
			modelCreator.CreateModel (theModel);

			mock.VerifyAllExpectations ();
		}
コード例 #3
0
        public void WhenNotCalled()
        {
            IModelRepository mock = MockRepository.GenerateMock <IModelRepository> ();

            var modelCreator = new ModelCreator(mock);
            var theModel     = new AnotherModel()
            {
                FieldA = 1, FieldB = "Test"
            };

            modelCreator.CreateModel(theModel);

            mock.AssertWasNotCalled(p => p.Add(Arg <AnotherModel> .Is.Null));
        }
コード例 #4
0
        public void WhenArgumentIsAnything()
        {
            IModelRepository mock = MockRepository.GenerateMock <IModelRepository> ();

            var modelCreator = new ModelCreator(mock);
            var theModel     = new AnotherModel()
            {
                FieldA = 1, FieldB = "Test"
            };

            mock.Expect(p => p.Add(Arg <AnotherModel> .Is.Anything));
            modelCreator.CreateModel(theModel);

            mock.VerifyAllExpectations();
        }