public async Task PublishActor_SendSqsMessage() { var actor = new Actor { FirstName = "Bruce", LastName = "Willis" }; var response = await PublishClient.PublishActor(actor); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); SqsClientMock.Verify(x => x.PostMessageAsync( It.Is <Actor>(y => JsonConvert.SerializeObject(y) == JsonConvert.SerializeObject(actor))), Times.Once); }
public async Task PublishMovie_SendSqsMessage() { var movie = new Movie { Title = "Die hard", Genre = MovieGenre.Action }; var response = await PublishClient.PublishMovie(movie); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); SqsClientMock.Verify(x => x.PostMessageAsync( It.Is <Movie>(y => JsonConvert.SerializeObject(y) == JsonConvert.SerializeObject(movie))), Times.Once); }
public async Task GetHealthReport_ReturnsUnhealthy() { SqsClientMock.Setup(x => x.GetQueueStatusAsync()) .ReturnsAsync(new SqsStatus { IsHealthy = false }); var response = await HealthCheckClient.GetHealth(); Assert.AreEqual(HttpStatusCode.ServiceUnavailable, response.StatusCode); Assert.AreEqual("Unhealthy", response.Result.Status); }
public async Task GetHealthReport_ReturnsHealthy() { SqsClientMock.Setup(x => x.GetQueueStatusAsync()) .ReturnsAsync(new SqsStatus { IsHealthy = true }); var response = await HealthCheckClient.GetHealth(); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal("Healthy", response.Result.Status); }
public async Task GetHealthReport_ReturnsHealthy() { //#if (AddSqsPublisher || AddSqsConsumer) SqsClientMock.Setup(x => x.GetQueueStatusAsync()) .ReturnsAsync(new SqsStatus { IsHealthy = true }); //#endif var response = await HealthCheckClient.GetHealth(); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.AreEqual("Healthy", response.Result.Status); }
public void TestCleanup() { SqsClientMock.Verify(x => x.CreateQueueAsync(), Times.Once); SqsClientMock.VerifyNoOtherCalls(); }
public void TestInitialize() { SqsClientMock.Setup(x => x.GetMessagesAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(new List <Message>()); }