Exemple #1
0
        public static void Run()
        {
            Console.WriteLine($"{Environment.NewLine}*** PROTOTYPE PATTERN ***{Environment.NewLine}");

            Bike bike = new Bike
            {
                ModelName        = "Rocket",
                ProductionNumber = 1
            };

            BikeProductionLine line = new BikeProductionLine(bike, 10);

            line.Run();
        }
Exemple #2
0
        public void BikeProductionLine_Run_BuildsCorrectNumberOfBikes()
        {
            // Arrange
            int numberOfBikesToMake = 100;

            Mock <Bike>        mockBike = new Mock <Bike>();
            BikeProductionLine line     = new BikeProductionLine(mockBike.Object, numberOfBikesToMake);

            mockBike.Setup(m => m.Clone()).Returns(mockBike.Object);

            // Act
            line.Run();

            // Assert
            mockBike.Verify(m => m.Clone(), Times.Exactly(numberOfBikesToMake));
        }