-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-readme
- Loading branch information
Showing
19 changed files
with
1,608 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/Hazelcast.Net.Tests/Models/CacheSimpleEntryListenerOptionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) 2008-2024, Hazelcast, Inc. 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. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
namespace Hazelcast.Tests.Models | ||
{ | ||
using NUnit.Framework; | ||
using Hazelcast.Models; | ||
using Hazelcast.Core; | ||
using Hazelcast.Serialization; | ||
|
||
[TestFixture] | ||
public class CacheSimpleEntryListenerOptionsTests | ||
{ | ||
[Test] | ||
public void DefaultConstructor_SetsPropertiesToDefault() | ||
{ | ||
var options = new CacheSimpleEntryListenerOptions(); | ||
|
||
Assert.IsNull(options.CacheEntryListenerFactory); | ||
Assert.IsNull(options.CacheEntryEventFilterFactory); | ||
Assert.IsFalse(options.OldValueRequired); | ||
Assert.IsFalse(options.Synchronous); | ||
} | ||
|
||
[Test] | ||
public void Constructor_WithCacheSimpleEntryListenerOptionsArgument_CopiesProperties() | ||
{ | ||
var originalOptions = new CacheSimpleEntryListenerOptions | ||
{ | ||
CacheEntryListenerFactory = "TestFactory", | ||
CacheEntryEventFilterFactory = "TestFilterFactory", | ||
OldValueRequired = true, | ||
Synchronous = true | ||
}; | ||
var copiedOptions = new CacheSimpleEntryListenerOptions(originalOptions); | ||
|
||
Assert.AreEqual(originalOptions.CacheEntryListenerFactory, copiedOptions.CacheEntryListenerFactory); | ||
Assert.AreEqual(originalOptions.CacheEntryEventFilterFactory, copiedOptions.CacheEntryEventFilterFactory); | ||
Assert.AreEqual(originalOptions.OldValueRequired, copiedOptions.OldValueRequired); | ||
Assert.AreEqual(originalOptions.Synchronous, copiedOptions.Synchronous); | ||
} | ||
|
||
[Test] | ||
public void ToString_ReturnsExpectedFormat() | ||
{ | ||
var options = new CacheSimpleEntryListenerOptions | ||
{ | ||
CacheEntryListenerFactory = "TestFactory", | ||
CacheEntryEventFilterFactory = "TestFilterFactory", | ||
OldValueRequired = true, | ||
Synchronous = true | ||
}; | ||
|
||
var result = options.ToString(); | ||
|
||
StringAssert.Contains("cacheEntryListenerFactory='TestFactory'", result); | ||
StringAssert.Contains("cacheEntryEventFilterFactory='TestFilterFactory'", result); | ||
StringAssert.Contains("oldValueRequired=True", result); | ||
StringAssert.Contains("synchronous=True", result); | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/Hazelcast.Net.Tests/Models/DataPersistenceOptionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright (c) 2008-2024, Hazelcast, Inc. 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. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
using Hazelcast.Core; | ||
using NUnit.Framework; | ||
using Hazelcast.Models; | ||
using Hazelcast.Serialization; | ||
using NSubstitute; | ||
namespace Hazelcast.Tests.Models | ||
{ | ||
[TestFixture] | ||
public class DataPersistenceOptionsTests | ||
{ | ||
[Test] | ||
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var dataPersistenceOptions = new DataPersistenceOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
Assert.AreEqual(enabled, dataPersistenceOptions.Enabled); | ||
Assert.AreEqual(fsync, dataPersistenceOptions.Fsync); | ||
} | ||
|
||
[Test] | ||
public void WriteData_ReadData_WritesAndReadsDataCorrectly() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var dataPersistenceOptions = new DataPersistenceOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian); | ||
dataPersistenceOptions.WriteData(output); | ||
|
||
var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian); | ||
var readDataPersistenceOptions = new DataPersistenceOptions(); | ||
readDataPersistenceOptions.ReadData(input); | ||
|
||
Assert.AreEqual(dataPersistenceOptions.Enabled, readDataPersistenceOptions.Enabled); | ||
Assert.AreEqual(dataPersistenceOptions.Fsync, readDataPersistenceOptions.Fsync); | ||
} | ||
|
||
[Test] | ||
public void ToString_ReturnsCorrectFormat() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var dataPersistenceOptions = new DataPersistenceOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
var expectedString = $"DataPersistenceConfig{{enabled={enabled}, fsync={fsync}}}"; | ||
|
||
Assert.AreEqual(expectedString, dataPersistenceOptions.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2008-2024, Hazelcast, Inc. 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. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
using Hazelcast.Core; | ||
using NUnit.Framework; | ||
using Hazelcast.Models; | ||
using Hazelcast.Serialization; | ||
using NSubstitute; | ||
namespace Hazelcast.Tests.Models | ||
{ | ||
[TestFixture] | ||
public class DiskTierOptionsTests | ||
{ | ||
[Test] | ||
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly() | ||
{ | ||
var enabled = true; | ||
var deviceName = "TestDevice"; | ||
|
||
var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName }; | ||
|
||
Assert.AreEqual(enabled, diskTierOptions.Enabled); | ||
Assert.AreEqual(deviceName, diskTierOptions.DeviceName); | ||
} | ||
|
||
[Test] | ||
public void WriteData_ReadData_WritesAndReadsDataCorrectly() | ||
{ | ||
var enabled = true; | ||
var deviceName = "TestDevice"; | ||
var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName }; | ||
|
||
var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian); | ||
diskTierOptions.WriteData(output); | ||
|
||
var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian); | ||
var readDiskTierOptions = new DiskTierOptions(); | ||
readDiskTierOptions.ReadData(input); | ||
|
||
Assert.AreEqual(diskTierOptions.Enabled, readDiskTierOptions.Enabled); | ||
Assert.AreEqual(diskTierOptions.DeviceName, readDiskTierOptions.DeviceName); | ||
} | ||
|
||
[Test] | ||
public void ToString_ReturnsCorrectFormat() | ||
{ | ||
var enabled = true; | ||
var deviceName = "TestDevice"; | ||
var diskTierOptions = new DiskTierOptions { Enabled = enabled, DeviceName = deviceName }; | ||
|
||
var expectedString = $"DiskTierConfig{{enabled={enabled}, deviceName='{deviceName}'}}"; | ||
|
||
Assert.AreEqual(expectedString, diskTierOptions.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright (c) 2008-2024, Hazelcast, Inc. 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. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
using Hazelcast.Core; | ||
using NUnit.Framework; | ||
using Hazelcast.Models; | ||
using Hazelcast.Serialization; | ||
using NSubstitute; | ||
namespace Hazelcast.Tests.Models | ||
{ | ||
[TestFixture] | ||
public class HotRestartOptionsTests | ||
{ | ||
[Test] | ||
public void Constructor_WithValidParameters_InitializesPropertiesCorrectly() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var hotRestartOptions = new HotRestartOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
Assert.AreEqual(enabled, hotRestartOptions.Enabled); | ||
Assert.AreEqual(fsync, hotRestartOptions.Fsync); | ||
} | ||
|
||
[Test] | ||
public void WriteData_ReadData_WritesAndReadsDataCorrectly() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var hotRestartOptions = new HotRestartOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
var output = new ObjectDataOutput(1024, null, Endianness.LittleEndian); | ||
hotRestartOptions.WriteData(output); | ||
|
||
var input = new ObjectDataInput(output.Buffer, null, Endianness.LittleEndian); | ||
var readHotRestartOptions = new HotRestartOptions(); | ||
readHotRestartOptions.ReadData(input); | ||
|
||
Assert.AreEqual(hotRestartOptions.Enabled, readHotRestartOptions.Enabled); | ||
Assert.AreEqual(hotRestartOptions.Fsync, readHotRestartOptions.Fsync); | ||
} | ||
|
||
[Test] | ||
public void ToString_ReturnsCorrectFormat() | ||
{ | ||
var enabled = true; | ||
var fsync = true; | ||
|
||
var hotRestartOptions = new HotRestartOptions | ||
{ | ||
Enabled = enabled, | ||
Fsync = fsync | ||
}; | ||
|
||
var expectedString = $"HotRestartConfig{{enabled={enabled}, fsync={fsync}}}"; | ||
|
||
Assert.AreEqual(expectedString, hotRestartOptions.ToString()); | ||
} | ||
} | ||
} |
Oops, something went wrong.