Skip to content

Commit

Permalink
#69 - API always returns 304 as response from PUT request.
Browse files Browse the repository at this point in the history
Modified the InProcProvider initialisation to set a fully qualified assembly name, made similar change to Femah.Core.Femah.SetSwitchType
  • Loading branch information
lholman committed Apr 5, 2014
1 parent ddacc80 commit b579e6f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions Femah.Core.Tests/Femah.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Compile Include="FemahApiRequestTests.cs" />
<Compile Include="FemahApiTests.cs" />
<Compile Include="FemahTests.cs" />
<Compile Include="InProcProviderTests.cs" />
<Compile Include="InvalidRequestTestData.cs" />
<Compile Include="PercentageFeatureSwitchTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
43 changes: 43 additions & 0 deletions Femah.Core.Tests/InProcProviderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Femah.Core.Providers;
using NUnit.Framework;

namespace Femah.Core.Tests
{
public class InProcProviderTests
{
public enum FeatureSwitches
{
SomeNewFeature = 1
}

public class TheGetMethod
{

[SetUp]
public void Initialize()
{
}

[Test]
public void FeatureTypeIsFullyQualifiedAssemblyName()
{
//Arrange
var inProcProvider = new InProcProvider();
const string expectedFullyQualifiedFeatureType = "Femah.Core.FeatureSwitchTypes.SimpleFeatureSwitch, Femah.Core, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null";

//Act
Femah.Configure()
.FeatureSwitchEnum(typeof(FeatureSwitches))
.Initialise();

var featureSwitch = inProcProvider.Get("SomeNewFeature");

//Assert
Assert.AreEqual(expectedFullyQualifiedFeatureType, featureSwitch.FeatureType);


}
}

}
}
2 changes: 1 addition & 1 deletion Femah.Core/Femah.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ internal static void SetSwitchType(string name, string typeName)
{
newFeatureSwitch.Name = featureSwitch.Name;
newFeatureSwitch.IsEnabled = featureSwitch.IsEnabled;
newFeatureSwitch.FeatureType = featureSwitch.GetType().Name;
newFeatureSwitch.FeatureType = featureSwitch.GetType().AssemblyQualifiedName;
}

// Save as the new type of feature switch.
Expand Down
2 changes: 1 addition & 1 deletion Femah.Core/Providers/InProcProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Initialise( IEnumerable<string> featureSwitches)

foreach (var featureSwitch in featureSwitches)
{
_featureSwitches.Add(new SimpleFeatureSwitch { Name = featureSwitch, IsEnabled = false, FeatureType = featureSwitch.GetType().Name});
_featureSwitches.Add(new SimpleFeatureSwitch { Name = featureSwitch, IsEnabled = false, FeatureType = typeof(SimpleFeatureSwitch).AssemblyQualifiedName });
}
}

Expand Down

0 comments on commit b579e6f

Please sign in to comment.