Exemple #1
0
        public async Task Get_ReturnsInfo()
        {
            // arrange
            var dataStructureConverterMoq = new Mock <IDataStructureConverter>();

            dataStructureConverterMoq.Setup(x => x.Convert(It.IsAny <string>(), It.IsAny <object>()))
            .Returns(new Dictionary <string, object>
            {
                { "data", InfoHelper.Get() }
            });

            var sut = new InfoController(dataStructureConverterMoq.Object);

            // act
            var response = await sut.Get();

            var result = response as OkObjectResult;

            // assert
            Assert.NotNull(result);
        }
Exemple #2
0
        public async Task Get_ReturnsVersion()
        {
            // arrange
            var dataStructureConverterMoq = new Mock <IDataStructureConverter>();

            dataStructureConverterMoq.Setup(x => x.Convert(It.IsAny <string>(), It.IsAny <object>()))
            .Returns(new Dictionary <string, object>
            {
                { "data", InfoHelper.Get() }
            });

            var sut = new InfoController(dataStructureConverterMoq.Object);

            // act
            var response = await sut.Get();

            var result      = response as OkObjectResult;
            var resultValue = (Dictionary <string, object>)result.Value;

            var infoResult = (ApiInfoModel)resultValue["data"];

            // assert
            Assert.True(infoResult.Version.Length > 0);
        }