public async Task StopService_Returns_GetMoveoutStopServiceResponse_When_Mcf_Stop_Service_Fails() { //Arrange string installationGuid = "mockinstallationguid"; _accountApiMock.Setup(cam => cam.GetContractItems(It.IsAny <long>())).Returns(Task.FromResult(GetAccountResponse(installationGuid))); _deviceApiMock.Setup(dm => dm.GetInstallationDetail(It.IsAny <long>())).Returns(Task.FromResult(GetDeviceResponse(installationGuid))); var sampleResponse = JsonConvert.DeserializeObject <McfResponse <GetContractItemMcfResponse> >(GetContractItemMcfResponse.GetSampleData()); sampleResponse.Result = null; sampleResponse.Error = new McfErrorResult { Code = "Some mcf code:666", }; sampleResponse.Error.Message = new McfErrorMessage { Value = "Some mcf error message." }; _mcfClientMock.Setup(mcm => mcm.StopService(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <DateTimeOffset>())) .Returns(sampleResponse); var target = CreateTarget(); //Act var actual = await target.StopService(GetMoveOutStopServiceRequest()); //Assert actual.ShouldNotBeNull(); actual.Status.Count.ShouldBe(2); }
public async Task StopService_Returns_Null_When_ContractAccountId_Not_Found() { //Arrange string installationGuid = "mockinstallationguid"; var accountResponse = GetAccountResponse(installationGuid); accountResponse.ContractItems.Clear(); _accountApiMock.Setup(cam => cam.GetContractItems(It.IsAny <long>())).Returns(Task.FromResult(accountResponse)); _deviceApiMock.Setup(dm => dm.GetInstallationDetail(It.IsAny <long>())).Returns(Task.FromResult(GetDeviceResponse(installationGuid))); var sampleResponse = JsonConvert.DeserializeObject <McfResponse <GetContractItemMcfResponse> >(GetContractItemMcfResponse.GetSampleData()); _mcfClientMock.Setup(mcm => mcm.StopService(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <DateTimeOffset>())) .Returns(sampleResponse); var target = CreateTarget(); //Act var actual = await target.StopService(GetMoveOutStopServiceRequest()); //Assert actual.ShouldBeNull(); }
public async Task StopService_Returns_GetMoveoutStopServiceResponse_With_Invalid_InstallationIds() { //Arrange string installationGuid = "mockinstallationguid"; var deviceResponse = GetDeviceResponse("anothermockinstallationguid"); deviceResponse.Data = null; _accountApiMock.Setup(cam => cam.GetContractItems(It.IsAny <long>())).Returns(Task.FromResult(GetAccountResponse(installationGuid))); _deviceApiMock.Setup(dm => dm.GetInstallationDetail(It.IsAny <long>())).Returns(Task.FromResult(deviceResponse)); var sampleResponse = JsonConvert.DeserializeObject <McfResponse <GetContractItemMcfResponse> >(GetContractItemMcfResponse.GetSampleData()); _mcfClientMock.Setup(mcm => mcm.StopService(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <DateTimeOffset>())) .Returns(sampleResponse); var target = CreateTarget(); //Act var actual = await target.StopService(GetMoveOutStopServiceRequest()); //Assert actual.ShouldNotBeNull(); actual.Status.Count.ShouldBe(2); }