public async Task AddWord_Should_Return_First_Letter_And_Modify_State() { //Arrange _mockProviderService.Given("there is a count of 1 for words beginning with 'A'") .UponReceiving("a request with the word 'Aardvark'") .With(new ProviderServiceRequest { Method = HttpVerb.Put, Path = "/AddWord/Aardvark", Headers = new Dictionary <string, string> { { "Content-Length", "0" }, { "Content-Type", "text/plain; charset=utf-8" }, { "Host", "localhost:1234" } } }) .WillRespondWith(new ProviderServiceResponse { Status = 200, Headers = new Dictionary <string, string> { { "Content-Type", "application-json; charset=utf-8" } }, Body = new { Letter = "A", Count = "2" } }); var uriResolver = A.Fake <IServiceUriResolver>(); A.CallTo(() => uriResolver.GetServiceUri()).Returns(new Uri(_mockProviderServiceBaseUri)); var httpCommunicationClientFactory = A.Fake <ICommunicationClientFactory <HttpCommunicationClient> >(); A.CallTo(httpCommunicationClientFactory) .WithReturnType <Task <HttpCommunicationClient> >() .Returns(new HttpCommunicationClient(new HttpClient(), _mockProviderServiceBaseUri)); var fabricClientQueryManager = A.Fake <IFabricClientQueryManager>(); var consumer = new DefaultController(uriResolver, fabricClientQueryManager, httpCommunicationClientFactory ); var result = await consumer.AddWord("Aardvark"); var content = await((StringContent)result.Content).ReadAsStringAsync(); Assert.Equal("<h1>Aardvark</h1> added to partition with key <h2>1</h2>", content); _mockProviderService.VerifyInteractions(); }