コード例 #1
0
    public async Task GetAsync_ShouldReturnDefault_WithNonExistingFeatureName()
    {
        var nonExistingFeatureName = "AnyOtherFeature";
        var result = await blogFeatureAppService.GetOrDefaultAsync(testData.Blog_Id, nonExistingFeatureName);

        var defaultFeature = new BlogFeature(Guid.Empty, nonExistingFeatureName);

        result.ShouldNotBeNull();
        result.IsEnabled.ShouldBe(defaultFeature.IsEnabled);
    }
コード例 #2
0
    public async Task SetIfNotSetAsync(Guid blogId, string featureName, bool isEnabled)
    {
        var blogFeature = await BlogFeatureRepository.FindAsync(blogId, featureName);

        if (blogFeature == null)
        {
            var newBlogFeature = new BlogFeature(blogId, featureName, isEnabled);
            await BlogFeatureRepository.InsertAsync(newBlogFeature);
        }
    }