Пример #1
0
        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);
        }
Пример #2
0
        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);
        }