Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Structural data to the master branch #389

Merged
merged 69 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7f1e76f
Merge pull request #382 from mpostol/ebook
mpostol Apr 1, 2024
5729ea4
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 6, 2024
f3d7de4
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 6, 2024
e293563
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 7, 2024
4bc45a2
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 9, 2024
fd8a69d
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 9, 2024
2d4d7d9
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 9, 2024
adefd81
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 9, 2024
e3b1de3
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 14, 2024
528d099
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 14, 2024
c6562d6
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 15, 2024
a342b52
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 15, 2024
fba0171
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 16, 2024
5b64bac
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 16, 2024
4f39633
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 16, 2024
4fac031
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 16, 2024
e68f50e
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 17, 2024
8f9b0f7
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 18, 2024
5e54441
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 19, 2024
f52f60d
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 19, 2024
2fea5ec
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 20, 2024
7344860
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 20, 2024
68a17b6
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 20, 2024
585cfd6
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 22, 2024
a9243bf
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 22, 2024
e83a249
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 23, 2024
5c67f52
ExDM Add DI to the Catalog #385
mpostol Apr 24, 2024
aa0f637
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 25, 2024
d2098d6
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 25, 2024
d4fbc59
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 27, 2024
5d41b94
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 27, 2024
3e1fc30
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 27, 2024
6782ed0
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 29, 2024
12bc5c0
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 29, 2024
2a362f9
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 29, 2024
cb52fd2
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 30, 2024
d76f4b0
ExDM Add documentation to the selected parts of the code #369
mpostol Apr 30, 2024
9c3b6f6
ExDM Add documentation to the selected parts of the code #369
mpostol May 1, 2024
99e4c6e
ExDM Add documentation to the selected parts of the code #369
mpostol May 1, 2024
20f9892
ExDM Add documentation to the selected parts of the code #369
mpostol May 2, 2024
be4f570
ExDM Add documentation to the selected parts of the code #369
mpostol May 2, 2024
1d623e4
ExDM Add documentation to the selected parts of the code #369
mpostol May 2, 2024
73a2ba1
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
dbaed91
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
a844be8
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
355319b
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
f74b239
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
e6293a3
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
20d6007
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
0da221e
ExDM Add documentation to the selected parts of the code #369
mpostol May 3, 2024
667810f
ExDM Add documentation to the selected parts of the code #369
mpostol May 4, 2024
de8753c
ExDM Add documentation to the selected parts of the code #369
mpostol May 5, 2024
1973009
Programming in Practice - LINQ Expression - add description to README…
mpostol May 8, 2024
b01f7d6
ExDM Add documentation to the selected parts of the code #369
mpostol May 8, 2024
1146577
ExDM Add documentation to the selected parts of the code #369
mpostol May 9, 2024
b26c4e6
ExDM Add documentation to the selected parts of the code #369
mpostol May 10, 2024
c7dd652
ExDM Add documentation to the selected parts of the code #369
mpostol May 11, 2024
6523422
ExDM Add documentation to the selected parts of the code #369
mpostol May 12, 2024
f2fb5dc
ExDM Add documentation to the selected parts of the code #369
mpostol May 13, 2024
350a2f2
ExDM Add documentation to the selected parts of the code #369
mpostol May 13, 2024
58113ea
ExDM Add documentation to the selected parts of the code #369
mpostol May 14, 2024
6e14d50
ExDM Add documentation to the selected parts of the code #369
mpostol May 14, 2024
6caca43
ExDM Add documentation to the selected parts of the code #369
mpostol May 16, 2024
b01b615
ExDM Add documentation to the selected parts of the code #369
mpostol May 16, 2024
e9d9eaf
ExDM Add documentation to the selected parts of the code #369
mpostol May 16, 2024
3250d41
ExDM Add documentation to the selected parts of the code #369
mpostol May 17, 2024
f6e4de7
ExDM Add documentation to the selected parts of the code #369
mpostol May 17, 2024
c2f8c37
ExDM Add documentation to the selected parts of the code #369
mpostol May 17, 2024
fcc4006
ExDM Add documentation to the selected parts of the code #369
mpostol May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/ISSUE_TEMPLATE/MakeRelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ assignees: 'mpostol'
- [ ] Publish release
- [ ] Update the repository front page
- [ ] Update the GitHub pages documentation
- [ ] Close this issue and the parent milestone
- [ ] Close this issue and the parent milestone

``` txt
//Alpha, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, India, Juliet,
//Kilo, Lima, Mike, November, Oscar, Papa, Quebec, Romeo, Sierra, Tango,
//Uniform, Victor, Whiskey, X-Ray, Yankee, Zulu
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2023, Mariusz Postol LODZ POLAND.
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
Expand All @@ -19,24 +19,19 @@ namespace TP.FunctionalProgramming
[TestClass]
public class AnonymousFunctionsUnitTest
{
[TestMethod]
public void StringIsLongPredicateTest()
{
Assert.IsTrue(AnonymousFunctions.StringIsLongPredicate("g5F|z*tC&yKJU$"));
}

[TestMethod]
public void NamedMethodCallBackTest()
{
AnonymousFunctions _newInstance = new AnonymousFunctions();
CallBackTestClass _callBackResult = new CallBackTestClass();
Assert.IsFalse(_callBackResult.m_TestResult);
_newInstance.ConsistencyCheck(new AnonymousFunctions.CallBackTestDelegate(_callBackResult.CallBackTestResult));
AnonymousFunctions.CallBackTestDelegate _CallBackTestResult = new AnonymousFunctions.CallBackTestDelegate(_callBackResult.CallBackTestResult);
_newInstance.ConsistencyCheck(_CallBackTestResult);
Assert.IsTrue(_callBackResult.m_TestResult);
}

[TestMethod]
public void AnonymousMethodTest()
public void AnonymousMethodCallBackTest()
{
AnonymousFunctions _newInstance = new AnonymousFunctions();
bool _testResult = false;
Expand All @@ -47,11 +42,12 @@ public void AnonymousMethodTest()
}

[TestMethod]
public void LambdaCallTest()
public void LambdaExpressionCallBackTest()
{
AnonymousFunctions _newInstance = new AnonymousFunctions();
bool _testResult = false;
_newInstance.ConsistencyCheck(_result => _testResult = _result);
AnonymousFunctions.CallBackTestDelegate _CallBackTestResult = _result => _testResult = _result;
_newInstance.ConsistencyCheck(_CallBackTestResult);
Assert.IsTrue(_testResult);
}

Expand Down Expand Up @@ -97,6 +93,8 @@ public void EventTestMethod()
//_newInstance.OnStateChanged(_newInstance, _newInstance.CurrentStateHandler.CurrentState); //Error CS0070 The event 'AnonymousFunctions.OnStateChanged' can only appear on the left hand side of += or -= (except when used from within the type 'AnonymousFunctions')
}

#region Instrumentation

private class CallBackTestClass
{
internal bool m_TestResult = false;
Expand All @@ -106,5 +104,7 @@ internal void CallBackTestResult(bool returnResult)
m_TestResult = returnResult;
}
}

#endregion Instrumentation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void TypicalCallTestMethod()
/// You can invoke the extension method with instance method syntax.
/// </summary>
[TestMethod]
public void SequentialCallTestMethod()
public void CascadedCallTestMethod()
{
string _TestString = "Hello Extension Methods";
Assert.IsFalse(_TestString.WordCount().Even()); //To enable extension methods for a particular type, the definition must be visible.
Expand All @@ -46,32 +46,22 @@ public void SequentialCallTestMethod()
/// Test method of the rule: the existing class method cannot be replaced by an extension method.
/// </summary>
[TestMethod]
public void OverrideTestMethod()
public void CollisionWithInstanceMemberTest()
{
string _TestString = "Hello Extension Methods";
Assert.IsTrue(_TestString.Contains("Hello")); //An extension method with the same name and signature as an interface or class method will never be called.
string testString = "Hello Extension Methods";
Assert.IsTrue(testString.Contains("Hello")); //An extension method with the same name and signature as an interface or class method will never be called.
Assert.ThrowsException<NotImplementedException>(() => ExtensionMethods.Contains(testString, "Hello"));
}

/// <summary>
/// Calling the instance method if the reference is null is impossible.
/// Instance method call if the reference is null
/// </summary>
[TestMethod]
[ExpectedException(typeof(NullReferenceException))]
public void NullCallExceptionTest()
{
IMyInterface _myInterface = null;
_myInterface.MyInterfaceMethod(); //Here the runtime throws the exception NullReferenceException.
}

/// <summary>
/// Calling the extension method if the reference is null proceeds normally.
/// </summary>
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void NullCallTest()
{
IMyInterface _myInterface = null;
_myInterface.ProtectedMyInterfaceMethodCall();
Assert.ThrowsException<NullReferenceException>(() => _myInterface.MyInterfaceMethod()); //Here the runtime throws the exception NullReferenceException.
Assert.ThrowsException<ArgumentNullException>(() => _myInterface.ProtectedMyInterfaceMethodCall()); //Here the ProtectedMyInterfaceMethodCall method is executed despite the reference being null.
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
<ItemGroup>
<Compile Include="DelegateExampleUnitTest.cs" />
<Compile Include="ExtensionMethodsUnitTest.cs" />
<Compile Include="FunctionalProgrammingTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AnonymousFunctionsUnitTest.cs" />
<Compile Include="StaticClassTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunctionalProgramming\FunctionalProgramming.csproj">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
// https://github.com/mpostol/TP/discussions/182
//
// by introducing yourself and telling us what you do with this community.
//_____________________________________________________________________________________________________________________________________

using Microsoft.VisualStudio.TestTools.UnitTesting;
using static TP.FunctionalProgramming.FunctionalProgramming;

namespace TP.FunctionalProgramming
{
/// <summary>
/// Summary description for FunctionalProgrammingTest
/// </summary>
[TestClass]
public class FunctionalProgrammingTest
{
[TestMethod]
public void StringIsLongPredicateTest()
{
Assert.IsTrue(StringIsLongPredicate("g5F|z*tC&yKJU$"));
Assert.IsFalse(StringIsLongPredicate("g5F|z"));
}

//public TP.FunctionalProgramming.FunctionalProgramming variable; //Error CS0723 Cannot declare a variable of static type 'FunctionalProgramming'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
// https://github.com/mpostol/TP/discussions/182
//
// by introducing yourself and telling us what you do with this community.
//_____________________________________________________________________________________________________________________________________

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TP.FunctionalProgramming
{
[TestClass]
public class StaticClassTest
{
[TestMethod]
public void StaticClassTestMethod()
{
// StaticClass staticClassVariable; //Cannot declare a variable of static type 'StaticClass'

//StaticClass staticVariable;
Assert.AreEqual(123456.789, StaticClass.MinIncome);
Assert.AreEqual(987654.321, StaticClass.MaxIncome);
StaticClass.StaticClassInitializer(3.0, 1.0);
Assert.AreEqual(1.0, StaticClass.MinIncome);
Assert.AreEqual(3.0, StaticClass.MaxIncome);
Assert.AreEqual(2.0, StaticClass.AverageIncome);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2023, Mariusz Postol LODZ POLAND.
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
Expand Down Expand Up @@ -30,15 +30,6 @@ public interface IStateHandler

public class AnonymousFunctions
{
#region predicate

public static bool StringIsLongPredicate(string stringToTest)
{
return stringToTest.Length > 10;
}

#endregion predicate

#region test instrumentation

internal delegate void CallBackTestDelegate(bool testResult);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2023, Mariusz Postol LODZ POLAND.
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
Expand All @@ -22,14 +22,17 @@ public class DelegateExample
/// <param name="y">The y.</param>
public delegate int PerformCalculation(int x, int y);

public event EventHandler PerformSumMethodCalled;

/// <summary>
/// The perform calculation variable
/// </summary>
/// <returns>System.Int32.</returns>
public PerformCalculation PerformCalculationVar;

/// <summary>
/// An example of event
/// </summary>
public event EventHandler PerformSumMethodCalled;

/// <summary>
/// Initializes a new instance of the <see cref="DelegateExample"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2023, Mariusz Postol LODZ POLAND.
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
Expand All @@ -13,6 +13,17 @@

namespace TP.FunctionalProgramming
{
/// <summary>
/// Define an example interface named IMyInterface.
/// </summary>
public interface IMyInterface
{
/// <summary>
/// Any class that implements IMyInterface must implement the method that matches the following signature.
/// </summary>
void MyInterfaceMethod();
}

/// <summary>
/// Class ExtensionMethods - defines a few extension methods.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

//____________________________________________________________________________________________________________________________________
//
// Copyright (C) 2024, Mariusz Postol LODZ POLAND.
//
// To be in touch join the community by pressing the `Watch` button and get started commenting using the discussion panel at
//
// https://github.com/mpostol/TP/discussions/182
//
// by introducing yourself and telling us what you do with this community.
//_____________________________________________________________________________________________________________________________________

namespace TP.FunctionalProgramming
{
public static class FunctionalProgramming
{

/// <summary>
/// An example of predicate - stateless processing of the input argument
/// </summary>
/// <param name="stringToTest">text to be the subject of testing</param>
/// <returns>testing result of comparison the <paramref name="stringToTest"/> and 10 and returning <true> if it is greater than 10</returns>
public static bool StringIsLongPredicate(string stringToTest)
{
return stringToTest.Length > 10;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@
<Compile Include="AnonymousFunctions.cs" />
<Compile Include="DelegateExample.cs" />
<Compile Include="ExtensionMethods.cs" />
<Compile Include="FunctionalProgramming.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="IMyInterface.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StaticClass.cs" />
</ItemGroup>
<ItemGroup>
<None Include="README.AnonymousFunctions.md" />
<None Include="README.ExtensionMethods.md" />
<None Include="Readme.md" />
<None Include="READMEDelegateEvents.md" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down

This file was deleted.

Loading