Exemplo n.º 1
0
        public void GetAll()
        {
            // arrange
            IcustomersRepository repository = CreateRepository();

            // act
            var cmusers = repository.GetAllCustomers();

            // assert
            cmusers.Should().NotBeNull();
        }
Exemplo n.º 2
0
        public void Delete()
        {
            // arrange
            IcustomersRepository repository = CreateRepository();

            // act
            repository.DeleteCustomer(id);
            // create a new repository for verification purposes
            var deletedEntity = repository.GetCustomer(id);

            // assert
            deletedEntity.Should().BeNull();
        }
Exemplo n.º 3
0
        public customersController(IcustomersRepository customersRepository, ITracer tracer)
        {
            _customersRepository = customersRepository;
            var operationName = "CustomerController/";
            var builder       = tracer.BuildSpan(operationName);

            using (var scope = builder.StartActive(true))
            {
                var span = scope.Span;

                var log = $"Endpoint Called";
                span.Log(log + " " + span.ToString());
            }
        }
Exemplo n.º 4
0
        public void Update()
        {
            // arrange
            IcustomersRepository repository = CreateRepository();

            // act
            var CustomersModel = repository.GetCustomer(id);

            CustomersModel.FirstName = "Bob";
            repository.UpdateCustomer(CustomersModel);
            var modifiedCustomersModel = repository.GetCustomer(id);

            // assert
            modifiedCustomersModel.FirstName.Should().Be("Bob");
        }
Exemplo n.º 5
0
        public void Insert()
        {
            // arrange
            IcustomersRepository repository = CreateRepository();
            var CustomersModel = new customersModel
            {
                Vat       = "213456777",
                Email     = "*****@*****.**",
                FirstName = "TestFirstName",
                LastName  = "TestLastName"
            };

            // act
            repository.InsertCustomer(CustomersModel);

            // assert
            CustomersModel.Id.Should().NotBe(0, "because Identity should have been assigned by database.");
            Console.WriteLine("New ID: " + CustomersModel.Id);
            id = CustomersModel.Id;
        }
 //public customersController(IcustomersRepository CustomersRepository)
 //{
 //    _repository = CustomersRepository;
 //}
 public customersController()
 {
     _repository = new customersRepository();
 }
 public customersController(IcustomersRepository CustomersRepository)
 {
     _repository = CustomersRepository;
 }