public PeopleController(ApplicationDbContext context, DbSetCachingService <Person> cachingService, MemoryCacheManager cacheManager, ISimple simple)
 {
     _context      = context;
     _dbCs         = cachingService;
     _cacheManager = cacheManager;
     _simple       = simple;
 }
Beispiel #2
0
        public void ShouldAllowPassingDifferentObjectsAndPrimitivesThroughParameters
        (
            [Any] int anInt,
            [Any] int anInt2,
            [Any] string aString,
            [Any] ISimple interfaceImplementation,
            [Any] IEnumerable <int> anEnumerable,
            [Any] List <string> concreteList,
            [Any] IEnumerable <ISimple> interfaceImplementationList,
            [Any] ProperValueType value //,
            //[AnyOtherThan(3,4)] int nonThree
        )
        {
            XAssert.NotEqual(default(int), anInt);
            XAssert.NotEqual(anInt2, anInt);
            Assert.False(string.IsNullOrEmpty(aString));
            Assert.NotNull(interfaceImplementation);
            Assert.Greater(anEnumerable.Count(), 0);
            Assert.Greater(concreteList.Count(), 0);
            Assert.Greater(concreteList.Count(), 0);

            Assert.Greater(interfaceImplementationList.Count(), 0);
            Assert.NotNull(interfaceImplementationList.ToArray()[0]);
            Assert.NotNull(interfaceImplementationList.ToArray()[1]);
            Assert.NotNull(interfaceImplementationList.ToArray()[2]);

            Assert.NotNull(value);

            //XAssert.NotEqual(3, nonThree);
        }
        static void Main(string[] args)
        {
            ServiceHost simpleHost = new ServiceHost(typeof(SimpleService), new Uri("http://localhost/Simple"));

            simpleHost.Open();

            ChannelFactory <ISimple> factory = new ChannelFactory <ISimple>(simpleHost.Description.Endpoints[0]);
            ISimple proxy = factory.CreateChannel();

            Logger.Debug("Calling Work...");
            var response1 = proxy.Work(new Request()
            {
                Name = "Foo"
            });

            Logger.Debug("Work() returned Success=" + response1.Success + " message='" + response1.ErrorMessage + "'");

            Logger.Debug("Calling Fail...");
            var response2 = proxy.Fail(new Request()
            {
                Name = "FooBar"
            });

            Logger.Debug("Fail() returned Success=" + response2.Success + " message='" + response2.ErrorMessage + "'");

            Console.WriteLine("Press ENTER to close the host.");
            Console.ReadLine();

            ((ICommunicationObject)proxy).Shutdown();

            simpleHost.Shutdown();
        }
Beispiel #4
0
        public void TestTheBasics()
        {
            ISimple class1 = GoInterface <ISimple, SimpleClass> .From(new SimpleClass());

            ISimple iface1 = GoInterface <ISimple, IDifferentName> .From(new SimpleClass());

            ISimple struct1 = GoInterface <ISimple, SimpleStruct> .From(new SimpleStruct(10));

            Assert.AreEqual(25, class1.Mutate(5));
            Assert.AreEqual(25, iface1.Mutate(5));
            Assert.AreEqual(70, struct1.Mutate(7));

            SimpleBase class2 = GoInterface <SimpleBase, SimpleClass> .From(new SimpleClass());

            SimpleBase iface2 = GoInterface <SimpleBase, IDifferentName> .From(new SimpleClass());

            SimpleBase struct2 = GoInterface <SimpleBase, SimpleStruct> .From(new SimpleStruct(10));

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(class1.Mutate(i), class2.Mutate(i));
                Assert.AreEqual(iface1.Mutate(i), iface2.Mutate(i));
                Assert.AreEqual(struct1.Mutate(i), struct2.Mutate(i));
            }

            Assert.AreEqual("forwarded!", struct1.ToString());
            Assert.AreEqual("forwarded!", struct2.ToString());
            Assert.AreEqual(struct1.GetHashCode(), struct2.GetHashCode());
            // Note that struct1.Equals(struct2) returns FALSE because struct2 is
            // not "really" a SimpleStruct. We must "unwrap" the right-hand side:
            Assert.That(struct1.Equals(GoInterface.Unwrap(struct2)));
            Assert.That(struct2.Equals(GoInterface.Unwrap(struct1)));
        }
Beispiel #5
0
 public void PlaceFindedCard(GwentCard Card, ISimple SimpleCard)
 {
     if (Card is IPlaceable)
     {
         Card.CardLine = (SimpleCard.CardLine + 3);
         if (Card.CardLine > 6)
         {
             Card.CardLine = Card.CardLine % 6;
         }
         if (!SimpleCard.IsRemoved)
         {
             (Card as IPlaceable).PlaceCard(this);
         }
         else
         {
             RemoveFromLine(Card.CardLine, Card, SimpleCard.IsToUsed);
         }
     }
     else
     {
         AddWeatherCard(Card);
     }
     this.SelectedCardID = -1;
     this.AffectedCardID = -1;
 }
Beispiel #6
0
 private void ProcessSimple(Package pkg, ISimple Simple)
 {
     battlegnd.Control.Dispatcher.Invoke(() =>
     {
         battlegnd.CardArived(Simple);
     });
     SendGoodCommand();
 }
Beispiel #7
0
        public void CardArived(ISimple SimpleCard)
        {
            this.AffectedCardID = SimpleCard.AffectedCardPos;
            GwentCard FindedCard = GetCardByID(SimpleCard.CardID);
            GwentCard Card       = CopyGwentCard(FindedCard);

            Card.IsSpecialAbilitiPerformed = Card.WhenSendIsPerformed;
            PlaceFindedCard(Card, SimpleCard);
        }
Beispiel #8
0
 public void AddFigure(ISimple figure)
 {
     for (int i = 0; i < _simples.Length; i++)
     {
         if (_simples[i] == null)
         {
             _simples[i] = figure;
             break;
         }
     }
 }
Beispiel #9
0
 public ObjectWithInterfaceInConstructor(
     int a,
     ISimple constructorArgument,
     string b,
     ObjectWithInterfaceInConstructor constructorNestedArgument)
 {
     _a = a;
     ConstructorArgument = constructorArgument;
     _b = b;
     ConstructorNestedArgument = constructorNestedArgument;
 }
Beispiel #10
0
 private void ProcessPackage(Package pkg, Battleground battlegnd)
 {
     if (pkg is ICommandable)
     {
         ICommandable Command = pkg as ICommandable;
         ProcessCommand(pkg, Command);
     }
     if (pkg is ISimple)
     {
         ISimple Simple = pkg as ISimple;
         ProcessSimple(pkg, Simple);
     }
 }
        static void Main(string[] args)
        {
            //SimpleExample simEx = new SimpleExample();
            //simEx.SimpleFunc();
            //simEx.ExampleFunc();

            //using Runtime polmorphism..
            IExample ex = new SimpleExample();

            ex.ExampleFunc();

            //ISimple sim = new SimpleExample();
            ISimple sim = (ISimple)ex;//UR object will be now behave like ISimple so that it retains the data U have set using the IExample object. In other words, U share the same object in the form of sim.

            sim.SimpleFunc();
        }
        static void Main(string[] args)
        {
            ServiceHost simpleHost = new ServiceHost(typeof(SimpleService), new Uri("http://localhost/Simple"));

            simpleHost.Open();

            ChannelFactory <ISimple> factory = new ChannelFactory <ISimple>(simpleHost.Description.Endpoints[0]);

            factory.Endpoint.EndpointBehaviors.Add(new OperationLoggerEndpointBehavior());
            ISimple proxy = factory.CreateChannel();

            proxy.DoSomthing("hi");

            Console.WriteLine("Press ENTER to close the host.");
            Console.ReadLine();

            ((ICommunicationObject)proxy).Shutdown();

            simpleHost.Shutdown();
        }
Beispiel #13
0
 public NeedsBoth(ISimple a, IWithValue b)
 {
     _a = a;
     _b = b;
 }
Beispiel #14
0
 public NeedsSimple(ISimple a)
 {
     _a = a;
 }
Beispiel #15
0
 public NeedsSome(ISimple a, IWithValue b)
 {
     _a = a;
     _b = b;
 }
Beispiel #16
0
 public NeedsAny(ISimple a, IWithValue b)
 {
     _a = a;
     _b = b;
 }
 public ConstructorArgTest(ISimple simple, string arg1, string arg2) => Text = $"{simple.Name} {arg1} {arg2}";
Beispiel #18
0
 public ComplexDependency(ISimple simple, IEnumerable <ISimple> simples)
 {
     Simple  = simple;
     Simples = simples;
 }
Beispiel #19
0
        internal override void GenCode0(CodeGenContext context)
        {
            context.newLine(location);
            SetLine(context);

            if (args == null)
                args = ParentArgs(context);

            // object arguments = args;
            bool created;
            arguments = args.GenArgList(context, out created);

            if (parent_scope is BLOCK)
            {
                arguments.GenSimple(context);
                LoadBlock(context);
                context.stfld(Runtime.ArgList.block);
            }

            GenCall(context);

            context.ReleaseLocal(arguments, created);
        }
 public SimpleTypeDecorator(ISimple <T> inner)
 {
     _inner = inner;
 }
Beispiel #21
0
        internal override void GenCode0(CodeGenContext context)
        {
            context.newLine(location);
            SetLine(context);

            // Ruby.ArgList arguments = args;
            bool created;
            arguments = args.GenArgList(context, out created);
            GenCall(context);
            context.ReleaseLocal(arguments, created);
        }
 public Complex(Simple simple, ISimple iSimple, Func <Simple> complexClassFactory)
 {
 }
Beispiel #23
0
 public NeedsSimpleOptional(ISimple a)
 {
     _a = a;
 }
Beispiel #24
0
 public TypeWithTwoConstructors(ISimple argOne, IAnother argTwo, string somethingElse)
 {
 }
Beispiel #25
0
 public NeedsAny(ISimple a)
 {
     _a = a;
 }
Beispiel #26
0
 public ComplexBeast(ISimple simple)
 {
     this.Simple = simple;
 }
 public Level2(ISimple simple)
 {
 }
Beispiel #28
0
        internal override void GenCode0(CodeGenContext context)
        {
            if (Scanner.is_identchar(method_id[0]))
                context.newLine(location);
            
            SetLine(context);
            
            bool self_created, arguments_created = false;

            if (isVarAccess)
            {
                context.ldloc(0);
                context.call(Runtime.Frame.SetCallStatusVCall);
            }
            else
            {
                context.ldloc(0);
                context.call(Runtime.Frame.SetCallStatusNone);
            }

            // object self = receiver;
            self = context.PreCompute(receiver, "receiver", out self_created);

            if (args.ShortAndSimple())
                fixed_arguments = args.GenFixedArgs(context, out fixed_created);
            else
                arguments = args.GenArgList(context, out arguments_created);


            GenCall(context);

            context.ReleaseLocal(self, self_created);

            if (args.ShortAndSimple())
                for (int i = 0; i < fixed_created.Count; i++)
                    context.ReleaseLocal(fixed_arguments[i], fixed_created[i]);
            else
                context.ReleaseLocal(arguments, arguments_created);
        }
Beispiel #29
0
        internal void AssignOp(CodeGenContext context, string op, Node rhs)
        {
            // object a = array;
            bool a_created;
            ISimple a = context.PreCompute(array, "array", out a_created);

            // ArgList index = args;
            bool index_created;
            index = args.GenArgList(context, out index_created);

            // access <=> a[index];
            ARRAY_ACCESS access = new ARRAY_ACCESS((Node)a, new ProxyList(Index, location), location);

            // access1 = (access2 op rhs);
            access.Assign(context, METHOD_CALL.Create(access, op, rhs, location));

            context.ReleaseLocal(a, a_created);
            context.ReleaseLocal(index, index_created);
        }
 public MyService(IDependency dependency, ISimple simple)
 {
     _dependency = dependency;
     _simple     = simple;
 }
Beispiel #31
0
 public Another(ISimple simple)
 {
     Dependent = simple;
 }
Beispiel #32
0
 public TypeWithTwoConstructors(ISimple argOne, IAnother argTwo)
 {
     _argOne = argOne;
     _argTwo = argTwo;
 }
Beispiel #33
0
 public TypeWithTwoConstructors(ISimple argOne, IAnother argTwo)
 {
     _argOne = argOne;
     _argTwo = argTwo;
 }
Beispiel #34
0
 public TypeWithTwoConstructors(ISimple argOne, IAnother argTwo, string somethingElse)
 {
 }
Beispiel #35
0
 public Another(ISimple simple)
 {
     Dependent = simple;
 }
Beispiel #36
0
 public AdvancedAdapter(ISimple simplemedia)
 {
     this.simplemedia = simplemedia;
 }