예제 #1
0
        public void AddPersonAsExpected()
        {
            _input.GetNumber().Returns(1, 0);
            _input.GetNonEmptyString().Returns("Bob", "Marley", "555-555-1212");

            //Act
            _rolodex.DoStuff();

            //Assert
            _input.Received(2).GetNumber();
            _contacts.DidNotReceive().GetAllContacts();
            _recipes.DidNotReceive().GetAllRecipes();
            _contacts.DidNotReceiveWithAnyArgs().CreateCompany(null, null);
            _contacts.Received().CreatePerson("Bob", "Marley", "555-555-1212");
        }
예제 #2
0
        public void AddPersonAddsAPersonJustLikeYouWouldExpectItTo()
        {
            //Arrange

            _input.GetNumber().Returns(1, 0);
            _input.GetNonEmptyString().Returns("Bob", "Marley", "567-678-6878");

            //Act
            _rolodex.DoStuff();

            //Assert ( make sure the method calls with these reports) //
            _input.Received(2).GetNumber();
            _contacts.DidNotReceive().GetAllContacts();
            _recipes.DidNotReceive().GetAllRecipes();
            _contacts.DidNotReceiveWithAnyArgs().CreateCompany(null, null);
            _contacts.Received().CreatePerson("Bob", "Marley", "567-678-6878");
        }
예제 #3
0
        public void AddPersonAddsAPersonJustLikeYouWouldExpectItTo()
        {
            //Arrange
            IGetInputFromUsers input = Substitute.For <IGetInputFromUsers>();

            _input.GetNumber().Returns(1, 0);
            _input.GetNonEmptyString().Returns("Bob", "Marley", "555-555-1212");

            //Act
            _rolodex.DoStuff();

            //Assert
            _input.Received().GetNumber();
            _contacts.DidNotReceive().GetAllContacts();
            _recipes.DidNotReceive().GetAllRecipes();
            _contacts.DidNotReceiveWithAnyArgs().CreateCompany(null, null);
            _contacts.Received().CreatePerson("Bob", "Marley", "555-555-1212");
        }