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 capacity to use async calls in Gauge tests #45

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
84 changes: 84 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion

[*.cs]
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
dotnet-version: 8.0.x

- name: Build with dotnet on windows
if: matrix.os == 'windows-latest'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bin
obj
artifacts
.ionide
TestResults/
75 changes: 43 additions & 32 deletions Gauge.CSharp.Lib.UnitTests/DataStoreFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,57 @@
* Licensed under the Apache License, Version 2.0
* See LICENSE.txt in the project root for license information.
*----------------------------------------------------------------*/
using NUnit.Framework;
namespace Gauge.CSharp.Lib.UnitTests;

namespace Gauge.CSharp.Lib.UnitTests
[TestFixture]
public class DataStoreFactoryTests
{
[TestFixture]
public class DataStoreFactoryTests
[SetUp]
public void Setup()
{
[Test]
public void ShouldBeAbleToStoreValuesToDatastoreWithoutInitializing()
{
var dataStore = DataStoreFactory.ScenarioDataStore;
dataStore.Add("myKey", "myValue");
Assert.AreEqual(dataStore.Get("myKey"), "myValue");
}
DataStoreFactory.ClearAllDataStores();
}

[Test]
public void ShouldGetDataStoreForScenario()
{
var dataStore = DataStoreFactory.ScenarioDataStore;
[Test]
public void AddDataStore_ShouldSetTheSuiteDataStore_WhenCalledForSuiteDataStoreType()
{
DataStoreFactory.AddDataStore(1, DataStoreType.Suite);
Assert.IsNotNull(DataStoreFactory.SuiteDataStore);
}

Assert.NotNull(dataStore);
Assert.IsInstanceOf<DataStore>(dataStore);
}
[Test]
public void AddDataStore_ShouldNotOverwriteTheSuiteDataStore_WhenCalledForSuiteDataStoreTypeMoreThanOnce()
{
DataStoreFactory.AddDataStore(1, DataStoreType.Suite);
var dataStore = DataStoreFactory.SuiteDataStore;
DataStoreFactory.AddDataStore(1, DataStoreType.Suite);
Assert.AreSame(dataStore, DataStoreFactory.SuiteDataStore);
}

[Test]
public void ShouldGetDataStoreForSpec()
{
var dataStore = DataStoreFactory.SpecDataStore;
[Test]
public void AddDataStore_ShouldSetTheSpecDataStore_WhenCalledForSpecDataStoreType()
{
DataStoreFactory.AddDataStore(1, DataStoreType.Spec);
Assert.IsNotNull(DataStoreFactory.GetDataStoresByStream(1)[DataStoreType.Spec]);
}

Assert.NotNull(dataStore);
Assert.IsInstanceOf<DataStore>(dataStore);
}
[Test]
public void AddDataStore_ShouldSetTheScenaroDataStore_WhenCalledForScenarioDataStoreType()
{
DataStoreFactory.AddDataStore(1, DataStoreType.Scenario);
Assert.IsNotNull(DataStoreFactory.GetDataStoresByStream(1)[DataStoreType.Scenario]);
}

[Test]
public void ShouldGetDataStoreForSuite()
{
var dataStore = DataStoreFactory.SuiteDataStore;
[Test]
public void AddDataStore_ShouldKeepSeparateDataStores_WhenCalledForDifferentStreams()
{
DataStoreFactory.AddDataStore(1, DataStoreType.Scenario);
DataStoreFactory.AddDataStore(2, DataStoreType.Scenario);
var dict1 = DataStoreFactory.GetDataStoresByStream(1)[DataStoreType.Scenario];
var dict2 = DataStoreFactory.GetDataStoresByStream(2)[DataStoreType.Scenario];

Assert.NotNull(dataStore);
Assert.IsInstanceOf<DataStore>(dataStore);
}
Assert.AreNotSame(dict1, dict2);
dict1.Add("mykey", new object());
Assert.IsNull(dict2.Get("mykey"));
}
}
Loading
Loading