public void GetUniqueCosmosDBContainerNamesFromEventData_GivenEventsWhereOneStatusCodeIs429_ReturnsCollectionWithOneItem() { //Arrange EventData eventData1 = new EventData(Encoding.UTF8.GetBytes("")); eventData1.Properties.Add("statusCode", (int)HttpStatusCode.Created); eventData1.Properties.Add("collection", "specs"); EventData eventData2 = new EventData(Encoding.UTF8.GetBytes("")); eventData2.Properties.Add("statusCode", (int)HttpStatusCode.TooManyRequests); eventData2.Properties.Add("collection", "calcs"); IEnumerable <EventData> events = new[] { eventData1, eventData2 }; CosmosDbThrottledEventsFilter cosmosDbThrottledEventsFilter = new CosmosDbThrottledEventsFilter(); //Act IEnumerable <string> collections = cosmosDbThrottledEventsFilter.GetUniqueCosmosDBContainerNamesFromEventData(events); //Assert collections .Should() .HaveCount(1); collections .First() .Should() .Be("calcs"); }
public void GetUniqueCosmosDBContainerNamesFromEventData_GivenEventsWhereStatusCodeDoesNotExist_ReturnsEmptyCollections() { //Arrange EventData eventData1 = new EventData(Encoding.UTF8.GetBytes("")); eventData1.Properties.Add("statusCode", (int)HttpStatusCode.Created); EventData eventData2 = new EventData(Encoding.UTF8.GetBytes("")); eventData2.Properties.Add("statusCode", (int)HttpStatusCode.OK); IEnumerable <EventData> events = new[] { eventData1, eventData2 }; CosmosDbThrottledEventsFilter cosmosDbThrottledEventsFilter = new CosmosDbThrottledEventsFilter(); //Act IEnumerable <string> collections = cosmosDbThrottledEventsFilter.GetUniqueCosmosDBContainerNamesFromEventData(events); //Assert collections .Should() .BeNullOrEmpty(); }