Exemplo n.º 1
0
        public void GivenNoBugData_WhenAskingToCreate_ThenItShouldReturnNullObject()
        {
            // arrange
            const string   bugsJson        = "";
            IConfiguration configuration   = new InMemoryConfiguration().Instance();
            IHttpService   vstsHttpService = new VstsHttpService(new Uri(configuration["VstsApi:BaseUrl"]), new FakeHttpMessageHandler(bugsJson, new Uri(new Uri(configuration["VstsApi:BaseUrl"]), "/Strickland/_apis/wit/wiql?$top=10000&api-version=5.0-preview.2"), configuration["VstsApi:PAT"]));

            new Privateer().SetStaticField <VstsHttpService, HttpClient>((VstsHttpService)vstsHttpService, "_httpClient", null);
            IBugsFactory bugsFactory = new BugsFactory(vstsHttpService, configuration);

            // act
            Bugs bugs = bugsFactory.Create("Strickland").Result;

            // assert
            bugs.Should().BeOfType <NullBugs>();
        }