Beispiel #1
0
        public void BikeRace_Ride_CallsRideOnCompetitor()
        {
            // Arrange
            Mock <IBikeRace>  mockRace       = new Mock <IBikeRace>();
            Mock <Competitor> mockCompetitor = new Mock <Competitor>();

            mockRace.Setup(x => x.GetCompetitor(It.IsAny <BikeType>())).Returns(mockCompetitor.Object);

            Competitor competitor = mockRace.Object.GetCompetitor(BikeType.Hybrid);

            // Act
            competitor.Ride();

            // Assert
            mockCompetitor.Verify(m => m.Ride(), Times.Once);
        }