public void GetWords_ShouldReturnWordsSortedByValueDescendingNotUnique() { // Arrange WordsController wc = new WordsController(); //Act string[] saPost = new string[] { "dog", "cat", "horse", "elephant" }; Dictionary <int, string> resultPost = wc.Post(saPost); Dictionary <int, string> resultGetWords = wc.GetWords("-value", false); // Assert Dictionary <int, string> resExpected = new Dictionary <int, string> { { 2, "horse" }, { 3, "elephant" }, { 0, "dog" }, { 1, "cat" } }; CollectionAssert.AreEquivalent(resultGetWords, resExpected); }
public async void GivenLoadOptions_ControllerReturnsLoadResult() { // Arrange var loadOptions = new DataSourceLoadOptionsBase(); var words = Helper.FakeEnumerable(() => new Word().Fake()).ToList(); var loadResult = new LoadResult { data = words }; // Act _wordManager.Setup(m => m.DataSourceLoadAsync(loadOptions)) .ReturnsAsync(loadResult) .Verifiable(); var result = await _wordsController.GetWords(loadOptions).ConfigureAwait(false); // Assert _wordManager.Verify(m => m.DataSourceLoadAsync(loadOptions), Times.Once); Assert.Equal(typeof(ActionResult <LoadResponse <WordModel> >), result.GetType()); }