예제 #1
0
        public void RemovePhone_Should_ReturnFail_When_NumberIsMissing()
        {
            var user = _fixture.Create <User>();

            var root = new UserAggregationRoot(new UserState(user),
                                               Enumerable.Empty <IAggregationRootInterceptor <UserState, Guid> >(),
                                               Substitute.For <ILogger <UserAggregationRoot> >());
            var result = root.RemovePhone(null);

            result.Should().NotBeNull();
            result.Should().BeEquivalentTo(DomainError.PhoneError.MissingNumber);
        }
예제 #2
0
        public void RemovePhone_Should_ReturnOk()
        {
            var number = _fixture.Create <string>();
            var user   = _fixture.Build <User>()
                         .With(x => x.Phones, new HashSet <Phone>
            {
                new Phone
                {
                    Number = number
                }
            })
                         .Create();


            var root = new UserAggregationRoot(new UserState(user),
                                               Enumerable.Empty <IAggregationRootInterceptor <UserState, Guid> >(),
                                               Substitute.For <ILogger <UserAggregationRoot> >());
            var result = root.RemovePhone(number);

            result.Should().NotBeNull();
            result.Should().BeEquivalentTo(Result.Ok());
        }