Пример #1
0
        public void TestAddCustomerByMockingAdapterResponse()
        {
            var adapter     = new CustomerAdapterMocks().MockAddCustomer().Build();
            var newCustomer = new CustomerBuilder().JohnDoe().Build();

            var repo   = new Orchestrations.CustomerOrchestration.CustomerOrchestrator(adapter);
            var result = repo.AddCustomer(newCustomer);

            Assert.IsNotNull(result);
            Assert.AreEqual(newCustomer, result);
        }
        public void AdapterGetCustomerByIdTest()
        {
            var mockedAdapter = new CustomerAdapterMocks().MockGetCustomer().Build();

            var orch     = new CustomerOrchestrator(mockedAdapter);
            var response = orch.GetCustomerById(Guid.NewGuid());

            var expected = new CustomerBuilder(response.Id).JohnDoe().Build();

            Assert.IsNotNull(response);
            var comparison = Utilities.CompareObjects(expected, response);

            Assert.IsTrue(comparison.AreEqual, $"Expected [{expected}] Actual [{response}]");
        }