public void WhenAllTheCommandsAreUndone()
        {
            this.commandManager.UndoPreviousCommand();
            LogAssert.AreEqual("MyProperty after undo #1", 100, this.testObject.MyProperty);

            this.commandManager.UndoPreviousCommand();
        }
示例#2
0
        public void ThenTheSOAP11ServiceResponseIsAsExpected()
        {
            // Remove cross-platform differences
            var expected = this.expectedResponse.Replace("\r\n", "\n");
            var actual   = this.actualResponse.Replace("\r\n", "\n");

            LogAssert.AreEqual("Response", expected, actual);
        }
        public void WhenASeriesOfCommandsAreExecuted()
        {
            this.commandManager.ExecuteSetPropertyCommand(this.testObject, p => p.MyProperty, 100);
            LogAssert.AreEqual("MyProperty after set property command", 100, this.testObject.MyProperty);

            this.commandManager.ExecuteSetPropertyCommand(this.testObject, p => p.MyProperty, 200);
            LogAssert.AreEqual("MyProperty after set property command", 200, this.testObject.MyProperty);
        }
 private void AssertInitialState(MyAsyncDisposable disposable)
 {
     LogAssert.IsFalse("IsDisposed", disposable.IsDisposed);
     LogAssert.AreEqual("OnDisposing Call Position", 0, disposable.OnDisposingCallPosition);
     LogAssert.AreEqual("DisposeManagedResources Call Position", 0, disposable.DisposeManagedResourcesCallPosition);
     LogAssert.AreEqual("DisposeUnmanagedResources Call Position", 0, disposable.DisposeUnmanagedResourcesCallPosition);
     LogAssert.AreEqual("SetResourcesToNull Call Position", 0, disposable.SetResourcesToNullCallPosition);
     LogAssert.AreEqual("OnDisposed Call Position", 0, disposable.OnDisposedCallPosition);
     LogAssert.AreEqual("DisposeManagedResourcesAsync Call Position", 0, disposable.DisposeManagedResourcesAsyncCallPosition);
     LogAssert.AreEqual("DisposeUnmanagedResourcesAsync Call Position", 0, disposable.DisposeUnmanagedResourcesAsyncCallPosition);
 }
示例#5
0
        public void WhenInitialisationIsPerformed()
        {
            const CipherSuiteName  cipherSuiteName = CipherSuiteName.Ristretto255_SHA512;
            PrimeOrderGroupFactory pogFactory      = new();
            HashFunctionFactory    hfFactory       = new();
            CipherSuite            cipherSuite     = new CipherSuite(cipherSuiteName, ProtocolMode.Base, pogFactory, hfFactory);

            SodiumLibrary.InitialiseCryptography();
            LogAssert.AreEqual("Sodium library version", "1.0.18", SodiumLibrary.GetSodiumLibraryVersion());

            BaseModeClientContext clientContext = new(cipherSuite);
            BaseModeServerContext serverContext = new(cipherSuite);
        }
        public async Task ShouldPerformLifecycleOfOverridableAsyncDisposeMethods()
        {
            // ARRANGE
            var disposable = new MyAsyncDisposable(base.Logger);

            AssertInitialState(disposable);

            // ACT
            await disposable.DisposeAsync().ConfigureAwait(false);

            // ASSERT
            // Assert lifecycle of Async Dispose methods were invoked
            LogAssert.IsTrue("IsDisposed", disposable.IsDisposed);
            LogAssert.AreEqual("OnDisposing Call Position", 1, disposable.OnDisposingCallPosition);
            LogAssert.AreEqual("DisposeManagedResourcesAsync Call Position", 2, disposable.DisposeManagedResourcesAsyncCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResourcesAsync Call Position", 3, disposable.DisposeUnmanagedResourcesAsyncCallPosition);
            LogAssert.AreEqual("SetResourcesToNull Call Position", 4, disposable.SetResourcesToNullCallPosition);
            LogAssert.AreEqual("OnDisposed Call Position", 5, disposable.OnDisposedCallPosition);

            // Assert the normal Dispose methods were NOT invoked
            LogAssert.AreEqual("DisposeManagedResources Call Position", 0, disposable.DisposeManagedResourcesCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResources Call Position", 0, disposable.DisposeUnmanagedResourcesCallPosition);
        }
        public void ShouldPerformLifecycleOfOverridableDisposeMethods()
        {
            // ARRANGE
            var disposable = new MyAsyncDisposable(base.Logger);

            AssertInitialState(disposable);

            // ACT
            disposable.Dispose();

            // ASSERT
            // Assert lifecycle of Dispose methods were invoked
            LogAssert.IsTrue("IsDisposed", disposable.IsDisposed);
            LogAssert.AreEqual("OnDisposing Call Position", 1, disposable.OnDisposingCallPosition);
            LogAssert.AreEqual("DisposeManagedResources Call Position", 2, disposable.DisposeManagedResourcesCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResources Call Position", 3, disposable.DisposeUnmanagedResourcesCallPosition);
            LogAssert.AreEqual("SetResourcesToNull Call Position", 4, disposable.SetResourcesToNullCallPosition);
            LogAssert.AreEqual("OnDisposed Call Position", 5, disposable.OnDisposedCallPosition);

            // Assert async methods were NOT invoked
            LogAssert.AreEqual("DisposeManagedResourcesAsync Call Position", 0, disposable.DisposeManagedResourcesAsyncCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResourcesAsync Call Position", 0, disposable.DisposeUnmanagedResourcesAsyncCallPosition);
        }
示例#8
0
        public void ShouldPerformLifecycleOfOverridableMethods()
        {
            // ARRANGE
            var disposable = new MyDisposable(base.Logger);

            LogAssert.IsFalse("IsDisposed", disposable.IsDisposed);
            LogAssert.AreEqual("OnDisposing Call Position", 0, disposable.OnDisposingCallPosition);
            LogAssert.AreEqual("DisposeManagedResources Call Position", 0, disposable.DisposeManagedResourcesCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResources Call Position", 0, disposable.DisposeUnmanagedResourcesCallPosition);
            LogAssert.AreEqual("SetResourcesToNull Call Position", 0, disposable.SetResourcesToNullCallPosition);
            LogAssert.AreEqual("OnDisposed Call Position", 0, disposable.OnDisposedCallPosition);

            // ACT
            disposable.Dispose();

            // ASSERT
            LogAssert.IsTrue("IsDisposed", disposable.IsDisposed);
            LogAssert.AreEqual("OnDisposing Call Position", 1, disposable.OnDisposingCallPosition);
            LogAssert.AreEqual("DisposeManagedResources Call Position", 2, disposable.DisposeManagedResourcesCallPosition);
            LogAssert.AreEqual("DisposeUnmanagedResources Call Position", 3, disposable.DisposeUnmanagedResourcesCallPosition);
            LogAssert.AreEqual("SetResourcesToNull Call Position", 4, disposable.SetResourcesToNullCallPosition);
            LogAssert.AreEqual("OnDisposed Call Position", 5, disposable.OnDisposedCallPosition);
        }
示例#9
0
 public void ThenTheResultHasTheNamedPlaceholdersCorrectlyReplaced()
 {
     LogAssert.AreEqual("Expected text", this.expectedFormattedText, this.actualFormattedText);
 }
示例#10
0
 public void ThenTheOutputIntegerIsCorrect()
 => LogAssert.AreEqual("Output Integer from OS2IP", _expectedInt, _actualInt);
 public void ThenTheGeneratedByteArrayIsOfTheLengthForAGroupElement()
 => LogAssert.AreEqual("Byte array has expected length", _expectedLength, _actualBytes.Length);
 public void ThenTheInitialStateIsRestored()
 {
     LogAssert.AreEqual("MyProperty after undo #2", 1, this.testObject.MyProperty);
 }
 public void ThenTheObjectIsSerialisedCorrectly()
 {
     LogAssert.AreEqual("XML", this.expectedXml, this.actualXml);
 }