Skip to content

Commit

Permalink
Updates to code to check for null, changed to using project reference…
Browse files Browse the repository at this point in the history
…, changed to use RxProperty
  • Loading branch information
ChrisPulman committed Feb 15, 2018
1 parent 2337cf5 commit dda3cfa
Show file tree
Hide file tree
Showing 13 changed files with 364 additions and 286 deletions.
80 changes: 80 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# EditorConfig is awesome:http://EditorConfig.org

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# CSharp code style settings:
[*.cs]
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = anonymous_types,accessors,object_collection_array_initalizers,methods,properties,types
csharp_new_line_before_else = false
csharp_new_line_before_catch = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
11 changes: 5 additions & 6 deletions SerialPortRx.Tests/SerialPortRx.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -47,9 +46,6 @@
<Compile Include="SerialPortRxTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SerialPortRx\SerialPortRx.csproj">
<Project>{cda3585b-d3d6-4be4-9a6b-582ab5de0b8f}</Project>
Expand All @@ -59,6 +55,9 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
10 changes: 5 additions & 5 deletions SerialPortRx.Tests/SerialPortRxTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SerialPortRxTest
[Category("SerialPortRx")]
public void SimpleConstructor()
{
SerialPortRx src = new SerialPortRx();
var src = new SerialPortRx();
src.Dispose();
Assert.That(src.IsDisposed, Is.True);
}
Expand All @@ -21,7 +21,7 @@ public void SimpleConstructor()
[Category("SerialPortRx")]
public void SimpleConstructorWithPort()
{
SerialPortRx src = new SerialPortRx("COM1");
var src = new SerialPortRx("COM1");
Assert.That(src.PortName, Is.EqualTo("COM1"));
src.Dispose();
Assert.That(src.IsDisposed, Is.True);
Expand All @@ -31,7 +31,7 @@ public void SimpleConstructorWithPort()
[Category("SerialPortRx")]
public void SimpleConstructorWithPortandBaud()
{
SerialPortRx src = new SerialPortRx("COM1", 9600);
var src = new SerialPortRx("COM1", 9600);
Assert.That(src.PortName, Is.EqualTo("COM1"));
Assert.That(src.BaudRate, Is.EqualTo(9600));
src.Dispose();
Expand All @@ -42,12 +42,12 @@ public void SimpleConstructorWithPortandBaud()
[Category("SerialPortRx")]
public void SimpleConstructorWithPortandBaudAndDatabits()
{
SerialPortRx src = new SerialPortRx("COM1", 9600, 8);
var src = new SerialPortRx("COM1", 9600, 8);
Assert.That(src.PortName, Is.EqualTo("COM1"));
Assert.That(src.BaudRate, Is.EqualTo(9600));
Assert.That(src.DataBits, Is.EqualTo(8));
src.Dispose();
Assert.That(src.IsDisposed, Is.True);
}
}
}
}
2 changes: 1 addition & 1 deletion SerialPortRx.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.4.1" targetFramework="net461" />
<package id="NUnit" version="3.9.0" targetFramework="net461" />
</packages>
6 changes: 3 additions & 3 deletions SerialPortRx/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
[assembly: AssemblyConfiguration(".Net 4.6.1")]
[assembly: AssemblyCompany("ChrisPulman")]
[assembly: AssemblyProduct("SerialPortRx")]
[assembly: AssemblyCopyright("Copyright © https://github.com/ChrisPulman 2016")]
[assembly: AssemblyCopyright("Copyright © https://github.com/ChrisPulman 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("cda3585b-d3d6-4be4-9a6b-582ab5de0b8f")]
[assembly: AssemblyVersion("0.0.0.4")]
[assembly: AssemblyFileVersion("0.0.0.4")]
[assembly: AssemblyVersion("0.0.0.5")]
[assembly: AssemblyFileVersion("0.0.0.5")]
Loading

0 comments on commit dda3cfa

Please sign in to comment.