コード例 #1
0
        public void Selects_the_default_equality_comparer_for_types_without_a_comparer_registered()
        {
            //Arrange
            var comparerStore = new ComparersStore();

            var defaultComparer = EqualityComparer <string> .Default;

            //Act
            var wrapper = comparerStore.Get <string>() as EqualityComparerWrapper <string>;

            //Assert
            wrapper.Should().NotBeNull();
            wrapper.Comparer.Should().BeSameAs(defaultComparer);
        }
コード例 #2
0
        public void Selects_the_correct_equality_comparer_registered()
        {
            //Arrange
            var stringComparerMock = new Mock <IEqualityComparer <string> >();

            var comparerStore = new ComparersStore();

            comparerStore.Add(stringComparerMock.Object);

            //Act
            var wrapper = comparerStore.Get <string>() as EqualityComparerWrapper <string>;

            //Assert
            wrapper.Should().NotBeNull();
            wrapper.Comparer.Should().BeSameAs(stringComparerMock.Object);
        }