From 45ce7d8a10c90e9389d6ff0368567699bac2b9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 17 Oct 2021 13:29:07 +0200 Subject: [PATCH 1/2] Fix incomplete unit tests. --- FLS.Tests/Rules/FuzzyRuleTests.cs | 4 ++-- FLS.Tests/Rules/RuleFactoryTests.cs | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/FLS.Tests/Rules/FuzzyRuleTests.cs b/FLS.Tests/Rules/FuzzyRuleTests.cs index cffbf11..7443a8d 100644 --- a/FLS.Tests/Rules/FuzzyRuleTests.cs +++ b/FLS.Tests/Rules/FuzzyRuleTests.cs @@ -148,8 +148,8 @@ public void RuleValid_Success() var result2 = rule2.IsValid(); var result3 = rule3.IsValid(); var result4 = rule4.IsValid(); - var result5 = rule3.IsValid(); - var result6 = rule4.IsValid(); + var result5 = rule5.IsValid(); + var result6 = rule6.IsValid(); //Assert Assert.That(result1, Is.True, "result1"); diff --git a/FLS.Tests/Rules/RuleFactoryTests.cs b/FLS.Tests/Rules/RuleFactoryTests.cs index fe8e1a8..443bacc 100644 --- a/FLS.Tests/Rules/RuleFactoryTests.cs +++ b/FLS.Tests/Rules/RuleFactoryTests.cs @@ -12,15 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.Rules; using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.Rules { @@ -58,8 +53,8 @@ public void RuleFactory_Condition_Success() var result2 = rule2.IsValid(); var result3 = rule3.IsValid(); var result4 = rule4.IsValid(); - var result5 = rule3.IsValid(); - var result6 = rule4.IsValid(); + var result5 = rule5.IsValid(); + var result6 = rule6.IsValid(); //Assert Assert.That(result1, Is.True, "result1"); From 6581f798c90ffba2b0f1baad211911c75d7bac69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 17 Oct 2021 13:28:49 +0200 Subject: [PATCH 2/2] Update to .NET 5. --- .../TrapezoidCoGDefuzzificationTests.cs | 5 +- FLS.Tests/Examples/UsageExampleTests.cs | 13 +-- .../Extensions/IEnumerableExtensionsTests.cs | 37 +++---- FLS.Tests/FLS.Tests.csproj | 96 ++++------------ .../InferenceEngines/CoGFuzzyEngineTests.cs | 13 +-- .../FuzzyEngineFactoryTests.cs | 8 +- .../InferenceEngines/FuzzyEngineTests.cs | 16 +-- .../InferenceEngines/MoMFuzzyEngineTests.cs | 7 +- .../BellMembershipFunctionTests.cs | 12 +- .../CompositeMembershipFunctionTests.cs | 6 +- .../GaussianMembershipFunctionTests.cs | 10 +- .../MembershipFunctionCollectionTests.cs | 8 +- .../SandZShapedMembershipFunctionTests.cs | 10 +- .../TrapezoidMembershipFunctionTests.cs | 7 +- FLS.Tests/Properties/AssemblyInfo.cs | 36 ------ FLS.Tests/Rules/FuzzyRuleEvaluatorTests.cs | 7 +- FLS.Tests/Rules/FuzzyRuleTests.cs | 19 ++-- FLS.Tests/TestUtilities.cs | 9 +- FLS.nuspec | 6 +- FLS/FLS.csproj | 103 ++++-------------- FLS/Properties/AssemblyInfo.cs | 36 ------ 21 files changed, 102 insertions(+), 362 deletions(-) delete mode 100644 FLS.Tests/Properties/AssemblyInfo.cs delete mode 100644 FLS/Properties/AssemblyInfo.cs diff --git a/FLS.Tests/Defuzzification/TrapezoidCoGDefuzzificationTests.cs b/FLS.Tests/Defuzzification/TrapezoidCoGDefuzzificationTests.cs index 244a84c..0f64172 100644 --- a/FLS.Tests/Defuzzification/TrapezoidCoGDefuzzificationTests.cs +++ b/FLS.Tests/Defuzzification/TrapezoidCoGDefuzzificationTests.cs @@ -12,14 +12,11 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using NUnit.Framework; using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.Defuzzification { diff --git a/FLS.Tests/Examples/UsageExampleTests.cs b/FLS.Tests/Examples/UsageExampleTests.cs index e4befe8..7b819a5 100644 --- a/FLS.Tests/Examples/UsageExampleTests.cs +++ b/FLS.Tests/Examples/UsageExampleTests.cs @@ -12,15 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FLS; using FLS.Rules; namespace FLS.Tests @@ -46,7 +41,7 @@ public void UsageExample_Success() LinguisticVariable power = new LinguisticVariable("Power"); var low = power.MembershipFunctions.AddTriangle("Low", 0, 25, 50); var high = power.MembershipFunctions.AddTriangle("High", 25, 50, 75); - + IFuzzyEngine fuzzyEngine = new FuzzyEngineFactory().Default(); var rule1 = Rule.If(water.Is(cold).Or(water.Is(warm))).Then(power.Is(high)); @@ -62,9 +57,5 @@ public void UsageExample_Success() //Extra System.Diagnostics.Debug.WriteLine(result); } - - - - } } diff --git a/FLS.Tests/Extensions/IEnumerableExtensionsTests.cs b/FLS.Tests/Extensions/IEnumerableExtensionsTests.cs index 2d91357..98b15ac 100644 --- a/FLS.Tests/Extensions/IEnumerableExtensionsTests.cs +++ b/FLS.Tests/Extensions/IEnumerableExtensionsTests.cs @@ -1,13 +1,13 @@ #region License and Terms // MoreLINQ - Extensions to LINQ to Objects // Copyright (c) 2008 Jonathan Skeet. All rights reserved. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// +// // http://www.apache.org/licenses/LICENSE-2.0 -// +// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,6 @@ using System.Linq; using System.Text; using NUnit.Framework; -using NUnit.Framework.Constraints; using FLS; namespace MoreLinq.Test @@ -37,19 +36,19 @@ public void DistinctBy() } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void DistinctByNullSequence() { string[] source = null; - source.DistinctBy(x => x.Length); + var result = new TestDelegate(() => source.DistinctBy(x => x.Length)); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void DistinctByNullKeySelector() { - string[] source = { }; - source.DistinctBy((Func)null); + string[] source = Array.Empty(); + var result = new TestDelegate(() => source.DistinctBy((Func)null)); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } [Test] @@ -61,19 +60,19 @@ public void DistinctByWithComparer() } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void DistinctByNullSequenceWithComparer() { string[] source = null; - source.DistinctBy(x => x, StringComparer.Ordinal); + var result = new TestDelegate(() => source.DistinctBy(x => x, StringComparer.Ordinal)); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void DistinctByNullKeySelectorWithComparer() { - string[] source = { }; - source.DistinctBy(null, StringComparer.Ordinal); + string[] source = Array.Empty(); + var result = new TestDelegate(() => source.DistinctBy(null, StringComparer.Ordinal)); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } [Test] @@ -94,19 +93,19 @@ public void ForEach_Success() } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void ForEach_NullAction_Success() { - string[] source = { }; - source.ForEach(null); + string[] source = Array.Empty(); + var result = new TestDelegate(() => source.ForEach(null)); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } [Test] - [ExpectedException(typeof(ArgumentNullException))] public void ForEach_NullSource_Success() { string[] source = null; - source.ForEach(word => word.ToLower()); + var result = new TestDelegate(() => source.ForEach(word => word.ToLower())); + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), result); } } diff --git a/FLS.Tests/FLS.Tests.csproj b/FLS.Tests/FLS.Tests.csproj index d6d3c85..6e38efd 100644 --- a/FLS.Tests/FLS.Tests.csproj +++ b/FLS.Tests/FLS.Tests.csproj @@ -1,85 +1,33 @@ - - - + - Debug - AnyCPU - {B0B30274-DFD1-49B9-8E9E-EC04B3D7C6E3} + FLS.Test Library - Properties - FLS.Tests - FLS.Tests - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly + false + true + true true - bin\Release\ - TRACE - prompt - 4 + net5.0 + 7.3 + true + AnyCPU + false + false + disable + false + false + false + false + - - ..\Solution\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - {008088ec-5365-4ebd-bc54-97fc0bb4876c} - FLS + False + - - - - - + \ No newline at end of file diff --git a/FLS.Tests/InferenceEngines/CoGFuzzyEngineTests.cs b/FLS.Tests/InferenceEngines/CoGFuzzyEngineTests.cs index 0574bba..a53dcca 100644 --- a/FLS.Tests/InferenceEngines/CoGFuzzyEngineTests.cs +++ b/FLS.Tests/InferenceEngines/CoGFuzzyEngineTests.cs @@ -12,17 +12,12 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion + using FLS.Constants; -using FLS.Rules; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests { @@ -91,7 +86,6 @@ public void CoG_Trap_Defuzzify2_Success(Int32 waterInputValue, Double expectedVa } [Test] - [ExpectedException(ExpectedException = typeof(ArgumentException), ExpectedMessage = ErrorMessages.AllMembershipFunctionsMustBeTrapezoid)] public void CoG_Trap_Defuzzify_WrongType() { //Arrange @@ -110,9 +104,10 @@ public void CoG_Trap_Defuzzify_WrongType() fuzzyEngine.Rules.If(water.Is(hot)).Then(power.Is(low)); //Act - var result = fuzzyEngine.Defuzzify(new { water = 60 }); + var result = new TestDelegate(() => fuzzyEngine.Defuzzify(new { water = 60 })); //Assert + Assert.Throws(Is.InstanceOf(typeof(ApplicationException)), result, ErrorMessages.AllMembershipFunctionsMustBeTrapezoid); } [Test] diff --git a/FLS.Tests/InferenceEngines/FuzzyEngineFactoryTests.cs b/FLS.Tests/InferenceEngines/FuzzyEngineFactoryTests.cs index 4ad2a19..a482e6c 100644 --- a/FLS.Tests/InferenceEngines/FuzzyEngineFactoryTests.cs +++ b/FLS.Tests/InferenceEngines/FuzzyEngineFactoryTests.cs @@ -12,14 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.InferenceEngines { @@ -47,7 +43,5 @@ public void Factory_EngineType_Success(FuzzyEngineType engineType, Type defuzzTy Assert.That(engine, Is.InstanceOf()); Assert.That(engine.Defuzzification, Is.InstanceOf(defuzzType)); } - - } } diff --git a/FLS.Tests/InferenceEngines/FuzzyEngineTests.cs b/FLS.Tests/InferenceEngines/FuzzyEngineTests.cs index 4184c34..b065d6e 100644 --- a/FLS.Tests/InferenceEngines/FuzzyEngineTests.cs +++ b/FLS.Tests/InferenceEngines/FuzzyEngineTests.cs @@ -12,17 +12,11 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.Constants; -using FLS.MembershipFunctions; -using FLS.Rules; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests { @@ -36,7 +30,6 @@ public void Setup() } [Test] - [ExpectedException(ExpectedException = typeof(Exception), ExpectedMessage = ErrorMessages.RulesAreInvalid)] public void FuzzyEngine_InvalidRules_Success() { //Arrange @@ -55,13 +48,13 @@ public void FuzzyEngine_InvalidRules_Success() fuzzyEngine.Rules.If(water.Is(hot)); //Act - var result = fuzzyEngine.Defuzzify(new { water = 60 }); + var result = new TestDelegate(() => fuzzyEngine.Defuzzify(new { water = 60 })); //Assert + Assert.Throws(Is.InstanceOf(typeof(Exception)), result, ErrorMessages.RulesAreInvalid); } [Test] - [ExpectedException(ExpectedException = typeof(ArgumentException))] public void FuzzyEngine_InvalidInputs_Success() { //Arrange @@ -80,9 +73,10 @@ public void FuzzyEngine_InvalidInputs_Success() fuzzyEngine.Rules.If(water.Is(hot)).Then(power.Is(high)); //Act - var result = fuzzyEngine.Defuzzify(new { water = "invalid input" }); + var rule = new TestDelegate(() => fuzzyEngine.Defuzzify(new { water = "invalid input" })); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentException)), rule); } } } diff --git a/FLS.Tests/InferenceEngines/MoMFuzzyEngineTests.cs b/FLS.Tests/InferenceEngines/MoMFuzzyEngineTests.cs index a8cb667..f8777d5 100644 --- a/FLS.Tests/InferenceEngines/MoMFuzzyEngineTests.cs +++ b/FLS.Tests/InferenceEngines/MoMFuzzyEngineTests.cs @@ -12,14 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests { @@ -86,6 +82,5 @@ public void MoM_Defuzzify2_Success(Int32 waterInputValue, Double expectedValue) //Assert Assert.That(Math.Floor(result), Is.EqualTo(expectedValue)); } - } } diff --git a/FLS.Tests/MembershipFunctions/BellMembershipFunctionTests.cs b/FLS.Tests/MembershipFunctions/BellMembershipFunctionTests.cs index 49c95ff..3625e4f 100644 --- a/FLS.Tests/MembershipFunctions/BellMembershipFunctionTests.cs +++ b/FLS.Tests/MembershipFunctions/BellMembershipFunctionTests.cs @@ -12,16 +12,12 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.Constants; using FLS.MembershipFunctions; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.MembershipFunctions { @@ -77,17 +73,15 @@ public void Bell_Max_Success() } [Test] - [TestCase(ExpectedException = typeof(ArgumentException), ExpectedMessage = ErrorMessages.AArgumentIsInvalid)] public void Bell_InvalidInput() { //Arrange //Act - var membershipFunction = new BellMembershipFunction("test", 0, 50, 10); + var membershipFunction = new TestDelegate(() => new BellMembershipFunction("test", 0, 50, 10)); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentException)), membershipFunction, ErrorMessages.AArgumentIsInvalid); } - - } } diff --git a/FLS.Tests/MembershipFunctions/CompositeMembershipFunctionTests.cs b/FLS.Tests/MembershipFunctions/CompositeMembershipFunctionTests.cs index 2357d1d..fa59f76 100644 --- a/FLS.Tests/MembershipFunctions/CompositeMembershipFunctionTests.cs +++ b/FLS.Tests/MembershipFunctions/CompositeMembershipFunctionTests.cs @@ -12,15 +12,11 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.MembershipFunctions; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.MembershipFunctions { diff --git a/FLS.Tests/MembershipFunctions/GaussianMembershipFunctionTests.cs b/FLS.Tests/MembershipFunctions/GaussianMembershipFunctionTests.cs index dd1e8ea..cfea49c 100644 --- a/FLS.Tests/MembershipFunctions/GaussianMembershipFunctionTests.cs +++ b/FLS.Tests/MembershipFunctions/GaussianMembershipFunctionTests.cs @@ -12,16 +12,12 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.Constants; using FLS.MembershipFunctions; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests { @@ -77,15 +73,15 @@ public void Gaussian_Max_Success() } [Test] - [TestCase(ExpectedException = typeof(ArgumentException), ExpectedMessage = ErrorMessages.TouArgumentIsInvalid)] public void Gaussian_InvalidInput() { //Arrange //Act - var membershipFunction = new GaussianMembershipFunction("test", 50, 0); + var membershipFunction = new TestDelegate(() => new GaussianMembershipFunction("test", 50, 0)); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentException)), membershipFunction, ErrorMessages.TouArgumentIsInvalid); } } } diff --git a/FLS.Tests/MembershipFunctions/MembershipFunctionCollectionTests.cs b/FLS.Tests/MembershipFunctions/MembershipFunctionCollectionTests.cs index d950540..5f285c6 100644 --- a/FLS.Tests/MembershipFunctions/MembershipFunctionCollectionTests.cs +++ b/FLS.Tests/MembershipFunctions/MembershipFunctionCollectionTests.cs @@ -12,15 +12,11 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.MembershipFunctions; using NUnit.Framework; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.MembershipFunctions { @@ -59,7 +55,5 @@ public void MembershipFunctionCollection_Types_Success() Assert.That(collection.Any(mf => mf is ZShapedMembershipFunction), Is.True, "ZShaped"); Assert.That(collection.Any(mf => mf is CompositeMembershipFunction), Is.True, "Composite"); } - - } } diff --git a/FLS.Tests/MembershipFunctions/SandZShapedMembershipFunctionTests.cs b/FLS.Tests/MembershipFunctions/SandZShapedMembershipFunctionTests.cs index 10dc46a..c7fff6f 100644 --- a/FLS.Tests/MembershipFunctions/SandZShapedMembershipFunctionTests.cs +++ b/FLS.Tests/MembershipFunctions/SandZShapedMembershipFunctionTests.cs @@ -12,16 +12,12 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.Constants; using FLS.MembershipFunctions; using NUnit.Framework; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.MembershipFunctions { @@ -87,15 +83,15 @@ public void SandZ_Max_Success() } [Test] - [TestCase(ExpectedException = typeof(ArgumentException), ExpectedMessage = ErrorMessages.BArgumentIsInvalid)] public void S_InvalidInput() { //Arrange //Act - var SmembershipFunction = new SShapedMembershipFunction("test", 50, 0); + var membershipFunction = new TestDelegate(() => new SShapedMembershipFunction("test", 50, 0)); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentException)), membershipFunction, ErrorMessages.BArgumentIsInvalid); } } } diff --git a/FLS.Tests/MembershipFunctions/TrapezoidMembershipFunctionTests.cs b/FLS.Tests/MembershipFunctions/TrapezoidMembershipFunctionTests.cs index 6912702..9e6d130 100644 --- a/FLS.Tests/MembershipFunctions/TrapezoidMembershipFunctionTests.cs +++ b/FLS.Tests/MembershipFunctions/TrapezoidMembershipFunctionTests.cs @@ -12,15 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.MembershipFunctions; using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests { diff --git a/FLS.Tests/Properties/AssemblyInfo.cs b/FLS.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 3f51f8e..0000000 --- a/FLS.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FLS.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FLS.Tests")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("59a9ecd7-163d-41de-bed5-ff453dd138eb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FLS.Tests/Rules/FuzzyRuleEvaluatorTests.cs b/FLS.Tests/Rules/FuzzyRuleEvaluatorTests.cs index 208aaeb..0c4c1d4 100644 --- a/FLS.Tests/Rules/FuzzyRuleEvaluatorTests.cs +++ b/FLS.Tests/Rules/FuzzyRuleEvaluatorTests.cs @@ -12,16 +12,13 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using FLS.MembershipFunctions; using FLS.Rules; using NUnit.Framework; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.Rules { @@ -90,7 +87,7 @@ public void RuleEvaluation_Double_Success(Double a1, Double b1, Double c1, Boole var conjToken = new FuzzyRuleToken("and", And ? FuzzyRuleTokenType.And : FuzzyRuleTokenType.Or); var conj = new FuzzyRuleConditionConjunction() { FirstCondition = con1, SecondCondition = con2, Conjunction = conjToken }; con2.Conjunction = conj; - + //Act var srv = new FuzzyRuleEvaluator(); diff --git a/FLS.Tests/Rules/FuzzyRuleTests.cs b/FLS.Tests/Rules/FuzzyRuleTests.cs index 7443a8d..61dcc6b 100644 --- a/FLS.Tests/Rules/FuzzyRuleTests.cs +++ b/FLS.Tests/Rules/FuzzyRuleTests.cs @@ -12,16 +12,12 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion -using FLS; using FLS.Rules; using NUnit.Framework; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FLS.Tests.Rules { @@ -189,7 +185,6 @@ public void RuleInvalid_Success() } [Test] - [ExpectedException(ExpectedException = typeof(ArgumentNullException))] public void RuleIs_Exception() { //Arrange @@ -203,13 +198,13 @@ public void RuleIs_Exception() var high = power.MembershipFunctions.AddTrapezoid("High", 25, 50, 50, 75); //Act - var rule = new FuzzyRule().If(water.Is(null)).Then(power.Is(high)); + var rule = new TestDelegate(() => new FuzzyRule().If(water.Is(null)).Then(power.Is(high))); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), rule); } [Test] - [ExpectedException(ExpectedException = typeof(ArgumentNullException))] public void RuleOr_Exception() { //Arrange @@ -223,13 +218,13 @@ public void RuleOr_Exception() var high = power.MembershipFunctions.AddTrapezoid("High", 25, 50, 50, 75); //Act - var rule = new FuzzyRule().If(water.Is(cold).Or(null)).Then(power.Is(high)); + var rule = new TestDelegate(() => new FuzzyRule().If(water.Is(cold).Or(null)).Then(power.Is(high))); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), rule); } [Test] - [ExpectedException(ExpectedException = typeof(ArgumentNullException))] public void RuleThen_Exception() { //Arrange @@ -243,10 +238,10 @@ public void RuleThen_Exception() var high = power.MembershipFunctions.AddTrapezoid("High", 25, 50, 50, 75); //Act - var rule = new FuzzyRule().If(water.Is(cold)).Then(null); + var rule = new TestDelegate(() => new FuzzyRule().If(water.Is(cold)).Then(null)); //Assert + Assert.Throws(Is.InstanceOf(typeof(ArgumentNullException)), rule); } - } } diff --git a/FLS.Tests/TestUtilities.cs b/FLS.Tests/TestUtilities.cs index 0569e47..b412fe0 100644 --- a/FLS.Tests/TestUtilities.cs +++ b/FLS.Tests/TestUtilities.cs @@ -12,13 +12,10 @@ // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and -// limitations under the License. +// limitations under the License. #endregion using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; namespace FLS.Tests { @@ -26,7 +23,7 @@ public static class TestUtilities { public static String GetTestAssemblyDirectory() { - String codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; + String codeBase = Assembly.GetExecutingAssembly().Location; UriBuilder uri = new UriBuilder(codeBase); String path = Uri.UnescapeDataString(uri.Path); return System.IO.Path.GetDirectoryName(path); diff --git a/FLS.nuspec b/FLS.nuspec index 16b1a34..262b656 100644 --- a/FLS.nuspec +++ b/FLS.nuspec @@ -2,7 +2,7 @@ $id$ - 1.1.6 + 1.1.7 $author$ David Grupp http://www.apache.org/licenses/LICENSE-2.0.html @@ -13,6 +13,6 @@ For full release notes see https://github.com/davidgrupp/Fuzzy-Logic-Sharp/blob/master/releasenotes.md ]]> Copyright 2014 - FUZZY LOGIC SHARP + fuzzy logic theory - \ No newline at end of file + diff --git a/FLS/FLS.csproj b/FLS/FLS.csproj index 1919b14..f7a2d6e 100644 --- a/FLS/FLS.csproj +++ b/FLS/FLS.csproj @@ -1,89 +1,28 @@ - - - + - Debug - AnyCPU - {008088EC-5365-4EBD-BC54-97FC0BB4876C} - Library - Properties FLS - FLS - v4.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly + 1.1.7 + David Grupp + Copyright © 2014 + A fuzzy logic library for .NET + Fuzzy Logic Sharp + Fuzzy Logic Sharp + Library + false + true + true true - bin\Release\ - TRACE - prompt - 4 + net5.0 + 7.3 + true + AnyCPU + false + false + disable + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + \ No newline at end of file diff --git a/FLS/Properties/AssemblyInfo.cs b/FLS/Properties/AssemblyInfo.cs deleted file mode 100644 index 716a339..0000000 --- a/FLS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Fuzzy Logic Sharp")] -[assembly: AssemblyDescription("Fuzzy Logic Sharp. A fuzzy logic library for .NET")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("David Grupp")] -[assembly: AssemblyProduct("Fuzzy Logic Sharp")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("bf9b37d8-c501-48a1-aeb0-7fd0d0231f19")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.6")] -//[assembly: AssemblyFileVersion("1.1.0.0")]