Beispiel #1
0
        public CustomerServiceTest()
        {
            var options = new DbContextOptionsBuilder <DesafioContext>()
                          .UseInMemoryDatabase(databaseName: "Desafio_Memory_AddTest")
                          .Options;

            context = new DesafioContext(options);

            var service = new Service.Customer.CustomerService(context);

            service.Save(new Domain.Models.Customer()
            {
                Email = "*****@*****.**", Name = "Gesualdo Crocco"
            });
            service.Save(new Domain.Models.Customer()
            {
                Email = "*****@*****.**", Name = "Gesualdo Crocco 1"
            });
            service.Save(new Domain.Models.Customer()
            {
                Email = "*****@*****.**", Name = "Gesualdo Crocco 2"
            });
            service.Save(new Domain.Models.Customer()
            {
                Email = "*****@*****.**", Name = "Gesualdo Crocco 3"
            });
        }
Beispiel #2
0
        public void AddTest()
        {
            var service = new Service.Customer.CustomerService(context);

            service.Save(new Domain.Models.Customer()
            {
                Email = "*****@*****.**", Name = "Gesualdo Crocco 4"
            });

            Assert.AreEqual("*****@*****.**", context.Customers.FirstOrDefault().Email);
        }