Exemple #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("========== SimpleExample ==========");
     AdapterExample.GetSimpleExample();
     Console.WriteLine("========== PatternExample ==========");
     AdapterExample.GetPatternExample();
 }
Exemple #2
0
        static void Main(string[] args)
        {
            // Behavioural examples
            var strategy = new StrategyExample();

            strategy.RunExample();

            var chain = new ChainOfResponsibilityExample();

            chain.RunExample();

            var memento = new MementoExample();

            memento.RunExample();

            // Creational examples
            var singleton = new SingletonExample();

            singleton.RunExample();

            var builder = new BuilderExample();

            builder.RunExample();

            // Structural examples
            var adapter = new AdapterExample();

            adapter.RunExample();
        }
        static void Main(string[] args)
        {
            // Creational
            AbstractFactoryExample.RunExample();
            FactoryExample.RunExample();
            SingletonExample.RunExample();

            // Structural
            CompositeExample.RunExample();
            FacadeExample.RunExample();
            ProxyExample.RunExample();

            // Behavioral
            AdapterExample.RunExample();
            ChainOfResponseExample.RunExample();
            IteratorExample.RunExample();
            MediatorExample.RunExample();
            ObserverExample.RunExample();
            StrategyExample.RunExample();



            var delegateAndEvents = new DelegateAndEventExample();

            delegateAndEvents.RunDelegateExample();
            delegateAndEvents.RunEventExample();



            Console.ReadKey(true);
        }
Exemple #4
0
        public void ShouldThrowExceptionIfFirstArgumentNull()
        {
            //var sut = new AdapterExample(null, null);
            AdapterExample sut;
            Action         todo = () => sut = new AdapterExample(null, new MessageTestService());

            todo.Should().Throw <ArgumentNullException>();
        }
Exemple #5
0
        public void ShouldThrowExceptionIfAllArgumentNull()
        {
            //var sut = new AdapterExample(null, null);
            AdapterExample sut;
            Action         todo = () => sut = new AdapterExample(null, null);

            todo.Should().Throw <ArgumentNullException>();
        }
Exemple #6
0
        public void ShouldThrowExceptionIfSeconfArgumentNull()
        {
            //var sut = new AdapterExample(null, null);
            AdapterExample sut;
            Action         todo = () => sut = new AdapterExample(new AddressTestRepository(), null);

            todo.Should().Throw <ArgumentNullException>();
        }
Exemple #7
0
        public void ShouldAdapterExampleThrowArgumentNullExceptionIfAllArgumentsNull()
        {
            AdapterExample sut;

            //Delegate - Rogzitem a muveletet<
            Action act = () => sut = new AdapterExample(null, null);

            act.Should().Throw <ArgumentNullException>();
        }
Exemple #8
0
        public void ShouldAdapterExampleThrowArgumentNullExceptionIfSecondArgumentsNull()
        {
            AdapterExample sut;

            //Delegate - Rogzitem a muveletet<
            Action act = () => sut = new AdapterExample(new AddressTestRepository(), null);

            act.Should().Throw <ArgumentNullException>();
        }
Exemple #9
0
        public void ShouldAdapterExampleThrowArgumentNullExceptionIfFirstArgumentsNull()
        {
            AdapterExample sut;

            //Delegate - Rogzitem a muveletet<
            Action act = () => sut = new AdapterExample(null, new MessageTestService());

            act.Should().Throw <ArgumentNullException>();
        }
Exemple #10
0
        public void ShouldAdapterExampleThrowExceptionIfArgumentNull()
        {
            // AAA
            // Arrange
            AdapterExample sut;

            // Act
            Action todo = () => sut = new AdapterExample(null, null);

            // Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
Exemple #11
0
        public void ShouldAdapterExampleThrowExceptionIfSecondArgumentNull()
        {
            // AAA
            // Arrange
            AdapterExample sut;

            // Act
            Action todo = () => sut = new AdapterExample(new AddressTestRepository(), null);

            // Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
Exemple #12
0
        public void ShouldAdapterExampleThrowExceptionIfFirstArgumentNull()
        {
            // AAA
            // Arrange
            AdapterExample sut;

            // Act
            Action todo = () => sut = new AdapterExample(null, new MessageTestService());

            // Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
Exemple #13
0
        private static void Main(string[] args)
        {
            AbstractFactoryExample.Run();

            AdapterExample.Run();

            ChainOfResponsibilityExample.Run();

            FlyWeightExample.Run();

            SingletonExample.Run();

            MementoExample.Run();

            Console.ReadLine();
        }
        public void ShouldAdapterExampleThrowExceptionIfAllArgumentNull()
        {
            ///AAA
            //Arrange

            AdapterExample sut;//sut: System Under Test

            //e helyett:
            //var sut = new AdapterExample(null, null);

            //Act
            //rogzitem a muveletet
            Action todo = () => sut = new AdapterExample(null, null);

            //Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
        public void ShouldAdapterExampleThrowExceptionIfSecondArgumentNull()
        {
            //AAA
            //Arrange
            AdapterExample sut;

            //sut: System Under Test
            //ez helyett:
            //var sut = new AdapterExample(null, null);

            //Act
            //rögzítem a műveletet
            Action todo = () => sut = new AdapterExample(new AddressTestRepository(), null);

            //Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
        public void ShouldAdapterExampleThrowExceptionIfFirstArgumentNull()
        {
            //AAA
            //Arrange
            AdapterExample sut;

            //sut: System Under Test
            //ez helyett:
            //var sut = new AdapterExample(null, null);

            //Act
            //rögzítem a műveletet
            Action todo = () => sut = new AdapterExample(null, new MessageTestService());

            //Assert
            todo.ShouldThrow <ArgumentNullException>();
        }
Exemple #17
0
        static void Main(string[] args)
        {
            AdapterExample testAdapter = new AdapterExample();

            testAdapter.TestAdapter();

            Console.WriteLine("\n**********\n");

            ChainOfResponsibilityExample testChainOfResponsibility = new ChainOfResponsibilityExample();

            testChainOfResponsibility.TestChainOfResponsibility();

            Console.WriteLine("\n**********\n");

            Secretary testCommand = new Secretary();

            testCommand.PrintDocument();

            Console.WriteLine("\n**********\n");

            FacadeExample testFacade = new FacadeExample();

            testFacade.TestFacade();

            Console.WriteLine("\n**********\n");

            Furniture testAbstractFactory = new Furniture();

            testAbstractFactory.TestFurniture();

            Console.WriteLine("\n**********\n");

            FactoryMethodExample testFactoryMethod = new FactoryMethodExample();

            testFactoryMethod.TestFactoryMethod();

            Console.WriteLine("\n**********\n");

            OrderState OrderState = new OrderState();

            OrderState.Register();
            OrderState.Approve();
            OrderState.Dispatch();
        }
Exemple #18
0
        static void Main(string[] args)
        {
            Assert.AreEqual(args, null);

            #region Creational Patterns
            //Abstract Factory;
            AbstractFactoryExample.AbstractFactory();

            #endregion

            //Adapter
            AdapterExample.Adapter();

            #region beavioural Patterns
            // Visitor
            Visitor visitor = new Visitor();
            visitor.Main();

            //Decorator
            DecoratorExample.Decorator();

            //Command
            CommandExample.Command();

            //Observer
            ObserverExample.Observer();

            #endregion

            //BusinessDelegate
            BusinessDelegateExample.BusinessDelegate();

            //DataTransferObject
            DataTransferObjectExample transferObjectExample = new DataTransferObjectExample();
            transferObjectExample.StartDemo();

            //UnitOfWork
            UnitOfWorkExample.UnitOfWork();
        }
Exemple #19
0
 public void Adapter()
 {
     AdapterExample.Adapter();
 }