コード例 #1
0
        public void Constructor_Should_CreateWith_ModifiedDate()
        {
            // arrange
            var membership = MembershipFake.Finished().Generate();

            // act
            var sut = new ClosedMembershipState(membership, membership.ModifiedDate.Value);

            // assert
            sut.ModifiedDate.Should().NotBeNull().And.Be(membership.ModifiedDate);
        }
コード例 #2
0
        public void Finish_Should_Change_Nothing()
        {
            // arrange
            var membership = MembershipFake.Finished().Generate();
            var sut        = membership.GetState();

            // act
            sut.Finish();

            // assert
            sut.ModifiedDate.Should().NotBeNull().And.Be(membership.ModifiedDate);
        }
コード例 #3
0
        public void GetDuration_FinishedMembership_Should_Return_FixedDuration()
        {
            // arrange
            var sut = MembershipFake.Finished().Generate();
            var expectedDuration = sut.ModifiedDate.Value.Subtract(sut.CreatedDate);

            // act
            var result = sut.GetDuration();

            // assert
            sut.Should().NotBeNull().And.BeOfType <MembershipTestProxy>();
            sut.ModifiedDate.Should().NotBeNull();
            result.Should().Be(expectedDuration);
        }
コード例 #4
0
        public MembershipRepositoryMockBuilder Update(Membership input = null, Membership output = null)
        {
            var result = output ?? MembershipFake.Finished().Generate();

            if (input == null)
            {
                _mock.Setup(x => x.Update(It.IsAny <Membership>())).Returns(result);
            }
            else
            {
                _mock.Setup(x => x.Update(input)).Returns(result);
            }

            return(this);
        }