Example #1
0
        public void ShouldAddSomeCustomer()
        {
            CustomerId = Guid.NewGuid();
            var model = CustomerBuilder.New().WithId(CustomerId).Build();
            var ret   = customerWriteOnlyRepository.Add(model);

            ret.Should().Be(1);
        }
Example #2
0
        public void ShouldAddSomeCustomer()
        {
            var model = CustomerBuilder.New().Build();

            CustomerId = model.Id;
            var ret = customerWriteOnlyRepository.Add(model);

            ret.Should().Be(1);
        }
Example #3
0
        public void ShouldUpdateCustomer()
        {
            var model = customerReadOnlyRepository.GetById(idCustomer);

            model.Should().NotBeNull();
            var newModel = CustomerBuilder.New().WithId(model.Id).WithName("NewCustomer").Build();

            customerWriteOnlyRepository.Update(newModel);
        }
Example #4
0
        public void ShouldAddManyCustomers()
        {
            var models = new List <Customer>()
            {
                CustomerBuilder.New().Build(), CustomerBuilder.New().Build(), CustomerBuilder.New().Build()
            };
            var ret = customerWriteOnlyRepository.Add(models);

            ret.Should().Be(1);
        }
        public IList <Customer> GetCustomers()
        {
            //simulate database operation
            var alfredo = CustomerBuilder.New().WithFullName("Alfredo Landa").Build();
            var luis    = CustomerBuilder.New().WithFullName("Luis Landero").Build();

            return(new List <Customer> {
                alfredo, luis
            });
        }
Example #6
0
        public void ShouldAddSomeCustomers()
        {
            var models = new List <DemoCleanArchitecture.Domain.Customer.Customer>()
            {
                CustomerBuilder.New().Build(),
                CustomerBuilder.New().Build(),
                CustomerBuilder.New().Build()
            };
            var ret = customerWriteOnlyRepository.Add(models);

            ret.Should().Be(1);
        }
Example #7
0
        public void ShouldNotCreateDomainWithAgeNullOrEmpty(int age)
        {
            var model = CustomerBuilder.New().WithAge(age).Build();

            model.IsValid.Should().BeFalse();
        }
Example #8
0
        public void ShouldNotCreateDomainWithCustomerNameNullOrEmpty(string name)
        {
            var model = CustomerBuilder.New().WithName(name).Build();

            model.IsValid.Should().BeFalse();
        }
Example #9
0
        public void ShouldNotCreateDomainWithIdNullOrEmpty()
        {
            var model = CustomerBuilder.New().WithId(new Guid()).Build();

            model.IsValid.Should().BeFalse();
        }
Example #10
0
        public void ShouldCreateDomain()
        {
            var model = CustomerBuilder.New().Build();

            model.IsValid.Should().BeTrue();
        }
Example #11
0
 public void Should_Not_Create_A_Customer_Without_Email()
 {
     Assert.Throws <DomainException>(() => CustomerBuilder.New().WithEmail(null).Build())
     .WithMessage("Email is required");
 }
Example #12
0
 public void Should_Not_Create_A_Customer_Without_StreetAddress()
 {
     Assert.Throws <DomainException>(() => CustomerBuilder.New().WithStreetAddress(null).Build())
     .WithMessage("Street Address is required");
 }
Example #13
0
 public void customer_name_should_not_be_null_or_empty(string name)
 {
     Assert.Throws <ArgumentException>(() => CustomerBuilder.New().WithName(name).Build()).WithMessage(ExceptionMessage.DOMAIN_CUSTOMER_NAME_INVALID);
 }
Example #14
0
 public void customer_email_should_not_be_null_or_empty(string email)
 {
     Assert.Throws <ArgumentException>(() => CustomerBuilder.New().WithEmail(email).Build()).WithMessage(ExceptionMessage.DOMAIN_CUSTOMER_EMAIL_INVALID);
 }
Example #15
0
        public void ShouldNotCreateDomainWithNameLengthBiggerThan200(string name)
        {
            var model = CustomerBuilder.New().WithName(name).Build();

            model.IsValid.Should().BeFalse();
        }
Example #16
0
        public void ShouldNotCreateDomainWithEmailLengthBiggerThan100(string email)
        {
            var model = CustomerBuilder.New().WithEmail(email).Build();

            model.IsValid.Should().BeFalse();
        }
Example #17
0
 public void Should_Not_Create_A_Customer_Without_DocumentNumber()
 {
     Assert.Throws <DomainException>(() => CustomerBuilder.New().WithDocumentNumber(null).Build())
     .WithMessage("Document Number is required");
 }