Beispiel #1
0
        public void ShouldGetParsedValueFromGauge()
        {
            const string expected = "foo message with {}";
            const string input    = "foo message with <parameter>";

            var gaugeService       = A.Fake <IGaugeService>();
            var project            = A.Fake <EnvDTE.Project>();
            var gaugeApiConnection = A.Fake <IGaugeApiConnection>();

            var response = new APIMessage
            {
                MessageType       = APIMessage.Types.APIMessageType.GetStepValueResponse,
                MessageId         = 0,
                StepValueResponse = new GetStepValueResponse
                {
                    StepValue = new ProtoStepValue
                    {
                        ParameterizedStepValue = input,
                        StepValue = expected
                    }
                }
            };

            A.CallTo(() => gaugeApiConnection.WriteAndReadApiMessage(A <APIMessage> ._))
            .Returns(response);
            A.CallTo(() => gaugeService.GetApiConnectionFor(project)).Returns(gaugeApiConnection);
            var gaugeServiceClient = new GaugeServiceClient(gaugeService);

            var actual = gaugeServiceClient.GetParsedStepValueFromInput(project, input);

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void ShouldThrowExceptionWhenGetParsedValueWithApiNotInitialized()
        {
            const string input = "foo message with <parameter>";

            var gaugeService = A.Fake <IGaugeService>();
            var project      = A.Fake <EnvDTE.Project>();

            A.CallTo(() => gaugeService.GetApiConnectionFor(project)).Throws(() => new GaugeApiInitializationException());
            var gaugeServiceClient = new GaugeServiceClient(gaugeService);


            Assert.Throws <GaugeApiInitializationException>(() =>
                                                            gaugeServiceClient.GetParsedStepValueFromInput(project, input));
        }