コード例 #1
0
        public void Nap_WithSetup_AndConfiguraiton_CreatesNewNap_WithSetupApplied_And_PluginMethodsRun()
        {
            // Arrange
            var setup = new NapSetup();

            setup.InstallPlugin(_plugin);

            // Act
            var nap     = new NapClient(_config, setup);
            var request = nap.Get("test");

            // Assert
            Assert.Same(_config, nap.Config);
            A.CallTo(() => _plugin.Configure(A <INapConfig> ._)).MustHaveHappened();
            A.CallTo(() => _plugin.Prepare(A <NapRequest> ._)).MustNotHaveHappened();
            A.CallTo(() => _plugin.Execute <Result>(A <INapRequest> ._)).MustNotHaveHappened();
            A.CallTo(() => _plugin.Process(A <NapResponse> ._)).MustNotHaveHappened();
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NapClient" /> class.
 /// </summary>
 /// <param name="config">The initial configuration to utilize on creation.</param>
 /// <param name="setup">The setup to utilize during creation of any requests, or operation of the Nap library.</param>
 public NapClient(INapConfig config, NapSetup setup) : this(config.BaseUrl)
 {
     _setup  = setup;
     _config = Configure(config);
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NapClient" /> class.
 /// </summary>
 /// <param name="setup">The setup to utilize during creation of any requests, or operation of the Nap library.</param>
 public NapClient(NapSetup setup) : this()
 {
     _setup = setup;
 }
コード例 #4
0
 public NapSetupTests()
 {
     _napSetup = new NapSetup();
 }
コード例 #5
0
ファイル: NapConfigurationTests.cs プロジェクト: forki/Nap
        // Tests to ensure that *.config files get parsed correctly.

        public NapConfigurationTests()
        {
            _setup = new NapSetup();
            _setup.InstallPlugin <NapConfigurationPlugin>();
        }