Skip to content

Commit

Permalink
Merge pull request #16 from fossapps/naming
Browse files Browse the repository at this point in the history
chore(naming): update naming
  • Loading branch information
cyberhck authored Jul 11, 2020
2 parents 2d153ef + 706d02f commit 0b2923d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Sdk.Test/FeatureClientTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Fossapps.FeatureManager;
using FossApps.FeatureManager.Models;
using Fossapps.FeatureManager.Models;
using Moq;
using NUnit.Framework;

Expand Down Expand Up @@ -50,13 +50,13 @@ public void Setup()
var mockWorker = new Mock<IFeatureWorker>();
mockWorker.Setup(x => x.GetRunningFeatures()).Returns(runningFeatures);
var mockUserData = new Mock<IUserDataRepo>();
mockUserData.Setup(x => x.GetExperimentsForcedA()).Returns(new List<string>
mockUserData.Setup(x => x.GetForcedFeaturesA()).Returns(new List<string>
{
"ALL_A-1",
"ALL_A-2",
"ALL_A-3",
});
mockUserData.Setup(x => x.GetExperimentsForcedB()).Returns(new List<string>
mockUserData.Setup(x => x.GetForcedFeaturesB()).Returns(new List<string>
{
"ALL_B-1",
"ALL_B-2",
Expand Down Expand Up @@ -141,7 +141,7 @@ public void TestFeatureWithAllBAlwaysReturnsB()
}

[Test]
public void TestFeatureWithOverrideExperimentsToA()
public void TestFeatureWithOverrideFeaturesToA()
{
var dictionary = new Dictionary<char, int> {['A'] = 0, ['B'] = 0, ['X'] = 0, ['Z'] = 0};
var client = new FeatureClient(_featureWorker, _userDataRepo);
Expand All @@ -167,7 +167,7 @@ public void TestFeatureWithOverrideExperimentsToA()
}

[Test]
public void TestFeatureWithOverrideExperimentsToB()
public void TestFeatureWithOverrideFeaturesToB()
{
var dictionary = new Dictionary<char, int> {['A'] = 0, ['B'] = 0, ['X'] = 0, ['Z'] = 0};
var client = new FeatureClient(_featureWorker, _userDataRepo);
Expand Down
11 changes: 5 additions & 6 deletions Sdk/FeatureContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using FossApps.FeatureManager;
using FossApps.FeatureManager.Models;
using Fossapps.FeatureManager.Models;

namespace Fossapps.FeatureManager
{
Expand All @@ -18,13 +17,13 @@ public interface IFeatureWorker
public class FeatureWorker : IFeatureWorker
{
private readonly TimeSpan _syncInterval;
private readonly FossApps.FeatureManager.FeatureManager _manager;
private readonly FeatureManager _manager;
private IEnumerable<RunningFeature> _features;

public FeatureWorker(string endpoint, TimeSpan syncInterval)
{
_syncInterval = syncInterval;
_manager = new FossApps.FeatureManager.FeatureManager(new Uri(endpoint));
_manager = new FeatureManager(new Uri(endpoint));
}

public IEnumerable<RunningFeature> GetRunningFeatures()
Expand Down Expand Up @@ -77,11 +76,11 @@ private RunningFeature GetFeatureById(string featId)
}
public char GetVariant(string featId)
{
if (_userDataRepo.GetExperimentsForcedB().Any(x => x == featId))
if (_userDataRepo.GetForcedFeaturesB().Any(x => x == featId))
{
return 'B';
}
if (_userDataRepo.GetExperimentsForcedA().Any(x => x == featId))
if (_userDataRepo.GetForcedFeaturesA().Any(x => x == featId))
{
return 'A';
}
Expand Down
8 changes: 4 additions & 4 deletions Sdk/UserDataRepo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ public interface IUserDataRepo
{
public string GetUserId();

public IEnumerable<string> GetExperimentsForcedA()
public IEnumerable<string> GetForcedFeaturesA()
{
return new List<string>();
}

public IEnumerable<string> GetExperimentsForcedB()
public IEnumerable<string> GetForcedFeaturesB()
{
return new List<string>();
}
Expand All @@ -28,7 +28,7 @@ protected UserDataRepoBase(IHttpContextAccessor contextAccessor)
_contextAccessor = contextAccessor;
}

public IEnumerable<string> GetExperimentsForcedA()
public IEnumerable<string> GetForcedFeaturesA()
{
if (!_contextAccessor.HttpContext.Request.Headers.TryGetValue("X-Forced-Features-A", out var features))
{
Expand All @@ -38,7 +38,7 @@ public IEnumerable<string> GetExperimentsForcedA()
return features.ToString().Split(",").ToList();
}

public IEnumerable<string> GetExperimentsForcedB()
public IEnumerable<string> GetForcedFeaturesB()
{
if (!_contextAccessor.HttpContext.Request.Headers.TryGetValue("X-Forced-Features-B", out var features))
{
Expand Down
2 changes: 1 addition & 1 deletion Sdk/generate_sdk.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
mkdir -p Generated
docker run --net=host --rm -v $(pwd)/Generated:/app/sdk node bash -c "apt update && apt install libunwind-dev -y && npm i -g autorest@3.0.6187 && autorest --input-file=http://localhost:5000/swagger/v1/swagger.json --csharp --namespace=FossApps.FeatureManager --override-client-name=FeatureManager --output-folder=/app/sdk --clear-output-folder"
docker run --net=host --rm -v $(pwd)/Generated:/app/sdk node bash -c "apt update && apt install libunwind-dev -y && npm i -g autorest@3.0.6187 && autorest --input-file=http://localhost:5000/swagger/v1/swagger.json --csharp --namespace=Fossapps.FeatureManager --override-client-name=FeatureManager --output-folder=/app/sdk --clear-output-folder"

0 comments on commit 0b2923d

Please # to comment.