Beispiel #1
0
        public void Execute_uses_property_of_new_value_if_not_null()
        {
            // Arrange
            var last = _fixture.Create <UserModel>();
            var @new = _fixture.Create <UserModel>();

            var sut = new CoalescingFilter <UserModel>();

            // Act
            UserModel actual = sut.Execute(@new, last);

            // Assert
            actual.Should().NotBeSameAs(@new);
            actual.ShouldBeEquivalentTo(@new);
        }
Beispiel #2
0
        public void Execute_relays_to_ICoalescable()
        {
            // Arrange
            var last = _fixture.Create <CoalescableUserModel>();
            var @new = new CoalescableUserModel(
                last.Id, _fixture.Create <string>(), bio: null);

            var sut = new CoalescingFilter <CoalescableUserModel>();

            // Act
            CoalescableUserModel actual = sut.Execute(@new, last);

            // Assert
            actual.ShouldBeEquivalentTo(new
            {
                @new.Id,
                @new.UserName,
                last.Bio,
                last.Website
            });
        }
Beispiel #3
0
        public void Execute_uses_property_of_last_value_if_of_new_value_is_null()
        {
            // Arrange
            var last = _fixture.Create <UserModel>();
            var @new = new UserModel(
                last.Id, _fixture.Create <string>(), bio: null);

            var sut = new CoalescingFilter <UserModel>();

            // Act
            UserModel actual = sut.Execute(@new, last);

            // Assert
            actual.ShouldBeEquivalentTo(new
            {
                @new.Id,
                @new.UserName,
                last.Bio,
                last.Website
            });
        }