예제 #1
0
        static void Main(string[] args)
        {
            WeatherService.WeatherService weatherServiceClient = new WeatherService.WeatherService();
            var weatherResults = weatherServiceClient.ConvertCelciusToFahrenheit(30);

            WindsorContainer Container = new WindsorContainer();

            Container.AddFacility <WcfFacility>();

            Container.Register(
                Component.For <IRepository <Employee> >().ImplementedBy <Repository <Employee> >()
                );
            IEmployeeRepository _employeeRepository = Container.Resolve <EmployeeRepository>();

            WcfServiceHost.EmployeeService employeeServiceClient = new WcfServiceHost.EmployeeService(_employeeRepository);
            var employees = employeeServiceClient.GetEmployees();

            var emp = new Employee();

            emp.Name        = "CiaranMary";
            emp.Gender      = "Male";
            emp.DateOfBirth = Convert.ToDateTime("08/12/1982");
            employeeServiceClient.AddEmployee(emp);

            // var testEmployee = employeeServiceClient.GetEmployee(emp);
        }
예제 #2
0
        public void GetEmployeeById_WhenUsingID2ReturnMary()
        {
            // Arrange
            MockRepository      mocks = new MockRepository();
            IEmployeeRepository employeeRepository = mocks.Stub <IEmployeeRepository>();

            WcfServiceHost.EmployeeService employeeService = new WcfServiceHost.EmployeeService(employeeRepository);

            using (mocks.Record())
            {
                SetupResult.For(employeeRepository.GetAllEntities()).Return(_fakeEmployees);
            }

            // Act
            var results = employeeService.GetEmployees();

            // Assert
            Assert.AreEqual(2, results.Count());
        }