Beispiel #1
0
        public void GetFeatureFlag_Should_Return_True_For_StaffMemberFeature()
        {
            _featureFlagsService.Setup(p => p.GetFeatureFlag(It.Is <string>(p => p == nameof(FeatureFlags.StaffMemberFeature)))).Returns(true);

            var result = _controller.GetFeatureFlag(nameof(FeatureFlags.StaffMemberFeature));

            result.Value.Should().BeTrue();
        }
        public async Task GetFeatureFlagUnitTest()
        {
            //Arrange
            Mock <IConfiguration>            mockConfiguration = new Mock <IConfiguration>();
            FeatureFlagsStorageTable         context           = new FeatureFlagsStorageTable(mockConfiguration.Object);
            Mock <IFeatureFlagsStorageTable> mock = new Mock <IFeatureFlagsStorageTable>();

            mock.Setup(repo => repo.GetFeatureFlag(It.IsAny <string>())).Returns(Task.FromResult(GetTestRow()));
            FeatureFlagsController controller = new FeatureFlagsController(mock.Object);
            string featureFlagName            = "abc";

            //Act
            FeatureFlag result = await controller.GetFeatureFlag(featureFlagName);

            //Assert
            Assert.IsTrue(result != null);
            TestFeatureFlag(result ?? new FeatureFlag());
        }