public void ExtractDestination_Properly_Throws_When_Index_Less_Than_Segment_Zero() { //arrange var uri = new Uri("http://www.teste.com/index0/index1/index2/index3"); var config = Stub<IConfig>(); config.Stub(c => c.DestinationUrlSegementIndex).IgnoreArguments().Return(-1); var pathInspector = new ApiTransactionUtility(config); // act and assert Assert.Throws<ConfigurationErrorsException>(() => pathInspector.ExtractDestination(uri)); }
public void ExtractDestination_Properly_Returns_Decoded_UrlSegment_From_Config_Value_Index() { //arrange const string expected = DecodedUrl; var encodedUri = new Uri(string.Format("http://www.teste.com/index0/{0}/index2/index3", EncodedUrl)); var config = Stub<IConfig>(); config.Stub(c => c.DestinationUrlSegementIndex).IgnoreArguments().Return(2); var pathInspector = new ApiTransactionUtility(config); // act var actual = pathInspector.ExtractDestination(encodedUri); // assert Assert.AreEqual(expected, actual); }