public void WithAdditionalStateChanged_Returns_Copy_Other_Than_StateChanged(
            bool disposeInput,
            bool disposeOutput,
            Func <Transfer, int, CancellationToken, Task <int> > governor,
            Action <TransferStateChangedEventArgs> stateChanged,
            int maximumLingerTime,
            Action <TransferProgressUpdatedEventArgs> progressUpdated,
            Func <Transfer, CancellationToken, Task> acquireSlot,
            Action <Transfer> slotReleased)
        {
            var n = new TransferOptions(
                governor: governor,
                stateChanged: stateChanged,
                progressUpdated: progressUpdated,
                slotAwaiter: acquireSlot,
                slotReleased: slotReleased,
                maximumLingerTime: maximumLingerTime,
                disposeInputStreamOnCompletion: disposeInput,
                disposeOutputStreamOnCompletion: disposeOutput);

            var o = n.WithAdditionalStateChanged(null);

            Assert.Equal(disposeInput, o.DisposeInputStreamOnCompletion);
            Assert.Equal(disposeOutput, o.DisposeOutputStreamOnCompletion);
            Assert.Equal(governor, o.Governor);
            Assert.Equal(progressUpdated, o.ProgressUpdated);
            Assert.Equal(maximumLingerTime, o.MaximumLingerTime);
            Assert.Equal(acquireSlot, o.SlotAwaiter);
            Assert.Equal(slotReleased, o.SlotReleased);

            Assert.NotEqual(stateChanged, o.StateChanged);
        }
        public void WithAdditionalStateChanged_Returns_Copy_That_Does_Not_Throw_If_Both_StateChanged_Are_Null()
        {
            var n = new TransferOptions(stateChanged: null);

            var o = n.WithAdditionalStateChanged(null);

            var ex = Record.Exception(() => o.StateChanged(null));

            Assert.Null(ex);
        }
        public void WithAdditionalStateChanged_Returns_Copy_That_Executes_Both_StateChanged()
        {
            var one = false;
            var two = false;

            var n = new TransferOptions(stateChanged: (_) => { one = true; });

            var o = n.WithAdditionalStateChanged((_) => { two = true; });

            o.StateChanged(null);

            Assert.True(one);
            Assert.True(two);
        }