示例#1
0
    static void Main12()
    {
        ImplementationClass obj = new ImplementationClass();

        obj.Add(199, 299);
        obj.Sub(78, 34);
    }
示例#2
0
    static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();

        // Call the member.
        obj.SampleMethod();
    }
    static void Main()
    {
        // Declare an interface instance.
            ISampleInterface obj = new ImplementationClass();

            // Call the member.
            obj.SampleMethod();
    }
        public void AddFunctionShouldPass()
        {
            int a = 5;
            int b = 5;

            IImplementationClass uut = new ImplementationClass();

            Assert.AreEqual(uut.AddTwoNumbers(a, b), 10);
        }
        public void Interface_Successful()
        {
            var        serializer = new JsonSerializer();
            IInterface obj        = new ImplementationClass {
                RequiredProp = "test"
            };
            JsonValue expected = new JsonObject
            {
                { "#Type", typeof(ImplementationClass).AssemblyQualifiedName },
                { "RequiredProp", "test" }
            };

            var actual = serializer.Serialize(obj);

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void InterfaceWithoutMap_Successful()
        {
            var       serializer = new JsonSerializer();
            JsonValue json       = new JsonObject
            {
                { "RequiredProp", "test" }
            };
            IInterface expected = new ImplementationClass {
                RequiredProp = "test"
            };

            var actual = serializer.Deserialize <IInterface>(json);

            Assert.AreEqual(expected.RequiredProp, actual.RequiredProp);
            Assert.AreNotEqual(typeof(ImplementationClass), actual.GetType());
        }
示例#7
0
        public void InterfaceWithMap_Successful()
        {
            var       serializer = new JsonSerializer();
            JsonValue json       = new JsonObject
            {
                { "RequiredProp", "test" }
            };
            IInterface expected = new ImplementationClass {
                RequiredProp = "test"
            };

            serializer.AbstractionMap.Map <IInterface, ImplementationClass>();

            var actual = serializer.Deserialize <IInterface>(json);

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void UnimplementedInterface_ReturnsRunTimeImplementation()
        {
            var serializer = new JsonSerializer();
            var json       = new JsonObject {
                { "RequiredProp", "test" }
            };

            serializer.AbstractionMap.RemoveMap <IInterface>();
            IInterface expected = new ImplementationClass {
                RequiredProp = "test"
            };

            var actual = serializer.Deserialize <IInterface>(json);

            Assert.IsNotNull(actual);
            Assert.AreNotEqual(expected.GetType(), actual.GetType());
            Assert.AreEqual(expected.RequiredProp, actual.RequiredProp);
        }
示例#9
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        public static void Main()
        {
            RemotingConfiguration.Configure(
                Assembly.GetExecutingAssembly().GetName().Name +
                ".exe.config", true /*ensureSecurity*/);

            ImplementationClass <string> stringRemoteObject =
                new ImplementationClass <string>();

            Console.WriteLine("String Remote Object responds: " +
                              stringRemoteObject.HelloWorld("Hi Server"));

            Console.WriteLine();

            ImplementationClass <int> intRemoteObject =
                new ImplementationClass <int>();

            Console.WriteLine("Int Remote Object responds: " +
                              intRemoteObject.HelloWorld(42));
        }
示例#10
0
        public void TwoInterfacesWithSameNameDeserialized()
        {
            var       serializer = new JsonSerializer();
            JsonValue json       = new JsonObject
            {
                { "RequiredProp", "test" }
            };
            IInterface expected = new ImplementationClass {
                RequiredProp = "test"
            };
            var alternateJson = new JsonObject
            {
                { "Value", "string" }
            };

            var actual          = serializer.Deserialize <IInterface>(json);
            var alternateActual = serializer.Deserialize <AlternateNamespace.IInterface>(alternateJson);

            Assert.AreEqual(actual.GetType().Name + "2", alternateActual.GetType().Name);
        }
示例#11
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Text = Application.ProductName + " v" + Application.ProductVersion.Split('.')[0] + "." + Application.ProductVersion.Split('.')[1];

            SettingsDlog = new SettingsDialogBox();
            SettingsDlog.Show();
            SettingsDlog.Hide();
            DeviceDlog = new DeviceDialogBox();
            DeviceDlog.Show();
            DeviceDlog.Hide();
            SampleIDdlog                = new SampleIDForm();
            ControlPanel                = new ControlPanelClass();
            AnalyzeDlog                 = new AnalyzeForm();
            Implementation              = new ImplementationClass(this, SettingsDlog, DeviceDlog, SampleIDdlog, ControlPanel, AnalyzeDlog);
            DeviceDlog.Implementation   = Implementation;
            SettingsDlog.Implementation = Implementation;
            SampleIDdlog.Implementation = Implementation;
            ControlPanel.Implementation = Implementation;
            AnalyzeDlog.Implementation  = Implementation;
            Implementation.Init_Everything();
        }
示例#12
0
        static void Main(string[] args)
        {
            IEnumerable enums;

            int[]   arr = new int[2];
            Octagon oc;

            // Explicit interfaces: depending on which object type is chosen (concrete or one of the interfaces),
            // different Save method can be executed
            ImplementationClass impClass    = new ImplementationClass();
            ISaveable           saveable    = new ImplementationClass();
            IPersistable        persistable = new ImplementationClass();

            impClass.Save();                 //Save implementation from ImplementationClass
            saveable.Save();                 //Save implementation from ISaveable, if no explicit implementation, then uses standard Save from implementation class
            persistable.Save();              //Save implementation from IPersistable, then uses standard Save from implementation class
            ((ISaveable)impClass).Save();    //Save implementation from ISaveable
            ((IPersistable)impClass).Save(); //Save implementation from IPersistable

            IPersonRepository repo = DynamicRepositoryFactory.GetRepository();
            var result             = repo.GetPeople();

            Console.WriteLine("Hello World!");
        }
        static void TestInterfaceMethodWithRequiresUnreferencedCode()
        {
            IRequiresUnreferencedCode inst = new ImplementationClass();

            inst.RequiresUnreferencedCodeMethod();
        }
        public void ConfirmConstructorValue()
        {
            ImplementationClass implementation = new ImplementationClass(15);

            Assert.That(implementation.Value == 15);
        }
示例#15
0
        static void TestInterfaceMethodWithRequires()
        {
            IRequires inst = new ImplementationClass();

            inst.MethodWithRequires();
        }
示例#16
0
        static void Main(string[] args)
        {
            ImplementationClass foo = new ImplementationClass();

            foo.Test();
        }