Esempio n. 1
0
    public async Task GetValueShouldReturnStringValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        string value = await featuresService.GetValue <string>("Theme");

        // Assert
        value.ShouldBe("light");
    }
Esempio n. 2
0
    public async Task GetValueShouldFailIfMismatchTypeForStringValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        var exception = await featuresService.GetValue <decimal>("Theme").ShouldThrowAsync <Exception>();

        // Assert
        exception.Message.ShouldBe("The feature Theme is a string feature...");
    }
Esempio n. 3
0
    public async Task GetValueShouldReturnDecimalValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        decimal value = await featuresService.GetValue <decimal>("TaxPercent");

        // Assert
        value.ShouldBe(12.5m);
    }
Esempio n. 4
0
    public async Task GetValueShouldFailIfMismatchTypeForIntValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        var exception = await featuresService.GetValue <bool>("Delay").ShouldThrowAsync <Exception>();

        // Assert
        exception.Message.ShouldBe("The feature Delay is an integer feature...");
    }
Esempio n. 5
0
    public async Task GetValueShouldReturnIntValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        int value = await featuresService.GetValue <int>("Delay");

        // Assert
        value.ShouldBe(1000);
    }
Esempio n. 6
0
    public async Task GetValueShouldFailIfMismatchTypeForBooleanValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        var exception = await featuresService.GetValue <string>("Beta").ShouldThrowAsync <Exception>();

        // Assert
        exception.Message.ShouldBe("The feature Beta is a boolean feature...");
    }
Esempio n. 7
0
    public async Task GetValueShouldReturnBooleanValue()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        // Act
        bool value = await featuresService.GetValue <bool>("Beta");

        // Assert
        value.ShouldBeTrue();
    }
Esempio n. 8
0
    public async Task GetValueShouldFailIfNoFeatureFound()
    {
        // Arrange
        InitializeFeaturesData();
        var featuresService = new FeaturesService(_db, new Settings());

        string featureName = "X";

        // Act
        var exception = await featuresService.GetValue <string>(featureName).ShouldThrowAsync <Exception>();

        // Assert
        exception.Message.ShouldBe($"The feature {featureName} does not exist...");
    }