public void GetBuildProjectBySpecificationId_WhenSpeficationIdIsInValidFormat_ShouldReturnResult() { // Arrange ICalculationsApiClient mockApi = Substitute.For <ICalculationsApiClient>(); mockApi .GetBuildProjectBySpecificationId(Arg.Any <string>()) .Returns(new ApiResponse <Common.ApiClient.Calcs.Models.BuildProject>(HttpStatusCode.OK, new Common.ApiClient.Calcs.Models.BuildProject())); CalculationsRepository calculationsRepository = new CalculationsRepository(mockApi, CreateMapper()); // Act var configuredTaskAwaiter = calculationsRepository.GetBuildProjectBySpecificationId("Test").ConfigureAwait(false).GetAwaiter(); BuildProject buildProject = configuredTaskAwaiter.GetResult(); // Assert buildProject.Should().NotBeNull(); mockApi.Received(1).GetBuildProjectBySpecificationId(Arg.Any <string>()); }
public void GetBuildProjectBySpecificationId_WhenSpeficationIdIsInValidFormat_ShouldReturnResult() { // Arrange ICalcsApiClientProxy mockApi = Substitute.For <ICalcsApiClientProxy>(); mockApi .GetAsync <BuildProject>(Arg.Any <string>()) .Returns(new BuildProject()); CalculationsRepository calculationsRepository = new CalculationsRepository(mockApi); ArgumentNullException exception = null; // Act var configuredTaskAwaiter = calculationsRepository.GetBuildProjectBySpecificationId("Test").ConfigureAwait(false).GetAwaiter(); BuildProject buildProject = configuredTaskAwaiter.GetResult(); // Assert buildProject.Should().NotBeNull(); mockApi.Received(1).GetAsync <BuildProject>(Arg.Any <string>()); }