public async void locale_should_return_locale_model() { //arrange var wordService = new Mock <IWordService>(); wordService.Setup(x => x.GetByKey("key")) .Returns(Task.FromResult(new Word())); //act var sut = new ApiControllerBuilder().WithWordService(wordService.Object) .Build(); var result = await sut.Locale("tr", "key"); //assert Assert.NotNull(result); Assert.NotNull(result.Data); Assert.IsAssignableFrom(typeof(LocaleModel), result.Data); sut.AssertGetAttribute(ActionNameLocale, new[] { typeof(string), typeof(string) }); wordService.Verify(x => x.GetByKey("key"), Times.Once); }
public async void locale_should_return_locale_model() { //arrange var wordService = new Mock<IWordService>(); wordService.Setup(x => x.GetByKey("key")) .Returns(Task.FromResult(new Word())); //act var sut = new ApiControllerBuilder().WithWordService(wordService.Object) .Build(); var result = await sut.Locale("tr", "key"); //assert Assert.NotNull(result); Assert.NotNull(result.Data); Assert.IsAssignableFrom(typeof(LocaleModel), result.Data); sut.AssertGetAttribute(ActionNameLocale, new[] { typeof(string), typeof(string) }); wordService.Verify(x => x.GetByKey("key"), Times.Once); }