Skip to content

Instantly share code, notes, and snippets.

@gyuwon
Created April 8, 2017 01:21
Show Gist options
  • Save gyuwon/e641c868e66c480db0dfb621f2907cb6 to your computer and use it in GitHub Desktop.
Save gyuwon/e641c868e66c480db0dfb621f2907cb6 to your computer and use it in GitHub Desktop.
CombineLatest 테스트 케이스
using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace RxUnitTest
{
[TestClass]
public class CombineLatestTest
{
[TestMethod]
public void CombineLatest_works_correctly()
{
// Arrange
var streamA = new BehaviorSubject<int>(3);
var streamB = new Subject<int>();
IObservable<int> combined = streamA.CombineLatest(streamB, (a, b) => a + b);
// Act
int actual = default(int);
combined.Subscribe(x => actual = x);
streamB.OnNext(4);
// Assert
Assert.AreEqual(7, actual);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment