From aef1f1ee2d2e5f2e1369159a828f6eb5a290844d Mon Sep 17 00:00:00 2001 From: Ivan Murashka Date: Sat, 22 Jun 2024 15:23:15 +0200 Subject: [PATCH] fix tests --- Tests/BinaryStorageTests.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Tests/BinaryStorageTests.cs b/Tests/BinaryStorageTests.cs index c224990..a2dcefa 100644 --- a/Tests/BinaryStorageTests.cs +++ b/Tests/BinaryStorageTests.cs @@ -426,6 +426,7 @@ public void WhenTypeMismatchBehaviorIsOverrideValueAndType_ThenValueAndTypeAreOv // Assert result.Should().BeTrue(); + storage.TypeOf("key").Should().Be(typeof(string)); storage.Get("key").Should().Be("value"); } @@ -445,11 +446,12 @@ public void WhenTypeMismatchBehaviorIsIgnore_ThenValueAndTypeAreIgnored() // Assert result.Should().BeFalse(); + storage.TypeOf("key").Should().Be(typeof(int)); storage.Get("key").Should().Be(123); } [Test] - public void WhenTypeMismatchBehaviorOverrideIsSetInGetMethod_ThenBehaviorIsOverridden() + public void WhenTypeMismatchBehaviorOverride_ThenBehaviorIsOverridden() { // Arrange using var storage = BinaryStorage.Construct(StoragePath) @@ -460,12 +462,13 @@ public void WhenTypeMismatchBehaviorOverrideIsSetInGetMethod_ThenBehaviorIsOverr storage.Set("key", 123); // Act - var value = storage.Get("key", "defaultValue", MissingKeyBehavior.InitializeWithDefaultValue); + var result = storage.Set("key", "value", TypeMismatchBehaviour.OverrideValueAndType); // Assert - value.Should().Be("defaultValue"); + result.Should().BeTrue(); storage.Has("key").Should().BeTrue(); - storage.Get("key").Should().Be("defaultValue"); + storage.TypeOf("key").Should().Be(typeof(string)); + storage.Get("key").Should().Be("value"); } #endregion