Exemplo n.º 1
0
        public void TestNullIReadOnlyList()
        {
            Assert.Pass();
            var my = new My01();

            my.F();
            IMy im = my;

            im.F();

            var m = new My02();
            //m.f();
            IMy i01 = (IMy)m;

            i01.F();
            IYou i02 = (IYou)m;

            i02.F();

            Environment.Exit(0);

            int?[] data   = { 1, null, 18, 22, 255 };
            var    result = data.OfType <int>();

            foreach (var r in result)
            {
                Console.WriteLine(r);
            }
        }
Exemplo n.º 2
0
        public static void Test()
        {
            IMy <Derived, Base> @base   = null;
            IMy <Base, Derived> derived = null;

            @base = derived;//OK
            //derived = @base;//Cannot implicitly convert type...
        }
 public ApiClient(IMy myService, IThis thisService, IUsersDirectory usersService, ICompaniesDirectory companiesService, IServicesDirectory servicesApi, IDataContainerService dataContainerService, IServiceProvider serviceLocator)
 {
     _myService        = myService;
     _thisService      = thisService;
     _usersService     = usersService;
     _companiesService = companiesService;
     _servicesApi      = servicesApi;
     _serviceLocator   = serviceLocator;
     Directory         = new Directory(_usersService, _companiesService, _servicesApi, dataContainerService, _serviceLocator);
 }
Exemplo n.º 4
0
        public void AssociateTypeHandlerTest()
        {
            TypeAccessor.AssociatedTypeHandler += delegate(Type parent)
            {
                if (parent == typeof(IMy))
                {
                    return(typeof(MyImpl));
                }
                return(null);
            };

            IMy i = TypeAccessor <IMy> .CreateInstance();

            i.Name = "John";

            Assert.AreEqual("John", i.Name);
            Assert.AreEqual("John", TypeAccessor <IMy> .Instance["Name"].GetValue(i).ToString());
        }
Exemplo n.º 5
0
 public Controller(IMy _my)
 {
     my = _my;
 }
Exemplo n.º 6
0
 public PolicyValidation(IMy myService)
 {
     _myService = myService;
 }
Exemplo n.º 7
0
 public PolicyValidation(IMy myService, ILogger logger)
 {
     _myService = myService;
     _logger    = logger;
 }
Exemplo n.º 8
0
 int GetFoo(this IMy my, string name)
 {
     return(my.GetFoo(name, DefaultFoo, DefaultBar));
 }
 public HomeController(ILogger <HomeController> logger, IMy myService, IWtfClient testClient)
 {
     _logger     = logger;
     _myService  = myService;
     _testClient = testClient;
 }
Exemplo n.º 10
0
 // DI ctor
 public MyController(IMy my)
 {
     _my = my;
 }
 public TestController(IMy myService)
 {
     _myService = myService;
 }