LetTest.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Reactive;
  10. using System.Reactive.Concurrency;
  11. using System.Reactive.Linq;
  12. using Microsoft.Reactive.Testing;
  13. using Xunit;
  14. using ReactiveTests.Dummies;
  15. using System.Reflection;
  16. using System.Threading;
  17. using System.Reactive.Disposables;
  18. using System.Reactive.Subjects;
  19. namespace ReactiveTests.Tests
  20. {
  21. public class LetTest : ReactiveTest
  22. {
  23. #region Let
  24. [Fact]
  25. public void Let_ArgumentChecking()
  26. {
  27. var someObservable = Observable.Empty<int>();
  28. ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Let(default(IObservable<int>), x => x));
  29. ReactiveAssert.Throws<ArgumentNullException>(() => ObservableEx.Let<int, int>(someObservable, null));
  30. }
  31. [Fact]
  32. public void Let_CallsFunctionImmediately()
  33. {
  34. bool called = false;
  35. Observable.Empty<int>().Let(x => { called = true; return x; });
  36. Assert.True(called);
  37. }
  38. #endregion
  39. }
  40. }