public void PutFeed_WithValidUpdate_ReturnsNoContent(int feedIdOfUpdatedFeed, Feed updatedFeed)
        {
            string inMemoryDatabaseName = $"PutFeed_WithValidUpdate_ReturnsNoContent{feedIdOfUpdatedFeed}";

            InsertMockFeedDataIntoInMemoryDatabase(inMemoryDatabaseName);
            using (var myInMemoryTechResourcesContext = InMemoryTechResourcesContext(inMemoryDatabaseName))
            {
                FeedsController feedsController            = GetNewFeedsController(myInMemoryTechResourcesContext);
                IActionResult   actionResultFromController = feedsController.PutFeed(feedIdOfUpdatedFeed, updatedFeed).Result;
                Assert.IsType <NoContentResult>(actionResultFromController);
            }
        }
        public void PutFeed_WithIncorrectFeedId_ReturnsBadRequest(int feedId, Feed updatedFeed)
        {
            string inMemoryDatabaseName = $"PutFeed_WithIncorrectFeedId_ReturnsBadRequest{feedId}";

            InsertMockFeedDataIntoInMemoryDatabase(inMemoryDatabaseName);
            int incorrectFeedId = feedId + 1;

            using (var myInMemoryTechResourcesContext = InMemoryTechResourcesContext(inMemoryDatabaseName))
            {
                FeedsController feedsController            = GetNewFeedsController(myInMemoryTechResourcesContext);
                IActionResult   actionResultFromController = feedsController.PutFeed(incorrectFeedId, updatedFeed).Result;
                Assert.IsType <BadRequestResult>(actionResultFromController);
            }
        }
        public void PutFeed_WithValidUpdateButDeletedFeedConccurencyIssue_ReturnsNotFound(int recentlyDeletedFeedId, Feed updatedVersionOfDeletedFeed)
        {
            string inMemoryDatabaseName = $"PutFeed_WithValidUpdateButDeletedFeedConccurencyIssue_ReturnsNotFound({recentlyDeletedFeedId}";

            InsertMockFeedDataIntoInMemoryDatabase(inMemoryDatabaseName);
            using (var myInMemoryTechResourcesContext = InMemoryTechResourcesContext(inMemoryDatabaseName))
            {
                Feed feedToDeleteToCauseConcurrencyIssue = myInMemoryTechResourcesContext.Feed.Find(recentlyDeletedFeedId);
                myInMemoryTechResourcesContext.Remove(feedToDeleteToCauseConcurrencyIssue);
                FeedsController feedsController            = GetNewFeedsController(myInMemoryTechResourcesContext);
                IActionResult   actionResultFromController = feedsController.PutFeed(recentlyDeletedFeedId, updatedVersionOfDeletedFeed).Result;
                Assert.IsType <NotFoundResult>(actionResultFromController);
            }
        }
        public void PutFeed_WithValidUpdate_UpdatesDatabase(int feedIdOfUpdatedFeed, Feed updatedFeed)
        {
            string inMemoryDatabaseName = $"PutFeed_WithValidUpdate_UpdatesDatabase{feedIdOfUpdatedFeed}";

            InsertMockFeedDataIntoInMemoryDatabase(inMemoryDatabaseName);
            using (var myInMemoryTechResourcesContext = InMemoryTechResourcesContext(inMemoryDatabaseName))
            {
                FeedsController feedsController            = GetNewFeedsController(myInMemoryTechResourcesContext);
                IActionResult   actionResultFromController = feedsController.PutFeed(feedIdOfUpdatedFeed, updatedFeed).Result;
            }

            using (var myInMemoryTechResourcesContext = InMemoryTechResourcesContext(inMemoryDatabaseName))
            {
                Feed   updatedFeedFromInMemoryDatabase           = myInMemoryTechResourcesContext.Feed.Find(feedIdOfUpdatedFeed);
                string serializedUpdatedFeedFromInMemoryDatabase = JsonConvert.SerializeObject(updatedFeedFromInMemoryDatabase);
                string expectedSerializedUpdatedFeed             = JsonConvert.SerializeObject(updatedFeed);
                Assert.Equal(expectedSerializedUpdatedFeed, serializedUpdatedFeedFromInMemoryDatabase);
            }
        }