Ejemplo n.º 1
0
        public void Parse_Positive(
            double widthA,
            double heightA,
            double widthB,
            double heightB,
            params string[] args
            )
        {
            // Arrange
            var expectedEnvelopes = new RectangularEnvelope[]
            {
                new RectangularEnvelope(widthA, heightA),
                new RectangularEnvelope(widthB, heightB)
            };

            // Act
            var actualEnvelopes = environment
                                  .Parse(args)
                                  .Cast <RectangularEnvelope>();

            var comparer = new RectangularEnvelopeEqualityComparer();

            // Assert
            Assert.Equal(expectedEnvelopes, actualEnvelopes, comparer);
        }
Ejemplo n.º 2
0
        public void RequestExtraEnvelopes_Positive(
            string inputString,
            double widthA,
            double heightA,
            double widthB,
            double heightB
            )
        {
            // Arrange
            var expectedEnvelopes = new RectangularEnvelope[]
            {
                new RectangularEnvelope(widthA, heightA),
                new RectangularEnvelope(widthB, heightB)
            };

            var consoleUserResponses = new Queue <string>(
                new[]
            {
                "yEs",
                inputString
            }
                );

            mockConsoleManager
            .Setup(c => c.ReadLine())
            .Returns(() => consoleUserResponses.Dequeue());

            // Act
            var actualEnvelopes = environment
                                  .RequestExtraEnvelopes()
                                  .Cast <RectangularEnvelope>();

            var equalityComparer = new RectangularEnvelopeEqualityComparer();

            Assert.Equal(
                expectedEnvelopes,
                actualEnvelopes,
                equalityComparer);
        }