Exemplo n.º 1
0
    public static void ServiceContract_TypedProxy_SyncOperation_UniqueTypeRefArg()
    {
        string           message = "Hello";
        BasicHttpBinding binding = null;
        ChannelFactory <IServiceContractUniqueTypeRefSyncService> factory = null;
        IServiceContractUniqueTypeRefSyncService serviceProxy             = null;
        UniqueType uniqueType = new UniqueType();

        try
        {
            // *** SETUP *** \\
            binding      = new BasicHttpBinding();
            factory      = new ChannelFactory <IServiceContractUniqueTypeRefSyncService>(binding, new EndpointAddress(Endpoints.ServiceContractSyncUniqueTypeRef_Address));
            serviceProxy = factory.CreateChannel();

            // *** EXECUTE *** \\
            serviceProxy.Request(message, ref uniqueType);

            // *** VALIDATE *** \\
            Assert.True((uniqueType.stringValue == message),
                        String.Format("The value of the 'stringValue' field in the UniqueType instance was not as expected. expected {0} but got {1}", message, uniqueType.stringValue));

            // *** CLEANUP *** \\
            ((ICommunicationObject)serviceProxy).Close();
            factory.Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
        }
    }
Exemplo n.º 2
0
 public QuickLinkNavigate(string columnName, object value, UniqueType unique = UniqueType.Single, object queryName = null) :
     this(new UniqueOptions(queryName ?? typeof(T))
 {
     UniqueType = unique,
     FilterOptions = new List <FilterOption>()
     {
         new FilterOption(columnName, value)
     }
 })
 {
 }
Exemplo n.º 3
0
 public static Lite <T> QueryUnique <T>(string columnName, object value, UniqueType uniqueType) where T : class, IEntity
 {
     return((Lite <T>) new UniqueOptions(typeof(T))
     {
         UniqueType = uniqueType,
         FilterOptions = new List <FilterOption>()
         {
             new FilterOption(columnName, value)
         }
     }.ToRequest().QueryUnique());
 }
Exemplo n.º 4
0
    public static Unique getUniqueTypeInfo(UniqueType type)
    {
        switch (type)
        {
        case UniqueType.WRONGWORLD_ROOTS:
            return(new Unique(
                       "Wrongworld Roots",
                       "Augotchi/Image/UIUnique/Wrongworldroot",
                       UniqueType.WRONGWORLD_ROOTS,
                       500
                       ));
        }

        return(null);
    }
Exemplo n.º 5
0
        public static T Unique <T>(this IEnumerable <T> collection, UniqueType uniqueType)
        {
            switch (uniqueType)
            {
            case UniqueType.First: return(collection.FirstEx());

            case UniqueType.FirstOrDefault: return(collection.FirstOrDefault());

            case UniqueType.Single: return(collection.SingleEx());

            case UniqueType.SingleOrDefault: return(collection.SingleOrDefaultEx());

            case UniqueType.SingleOrMany: return(collection.SingleOrMany());

            case UniqueType.Only: return(collection.Only());

            default: throw new InvalidOperationException();
            }
        }
Exemplo n.º 6
0
    public static void ServiceContract_TypedProxy_AsyncEndOperation_UniqueTypeOutArg()
    {
        string           message = "Hello";
        BasicHttpBinding binding = null;
        ChannelFactory <IServiceContractUniqueTypeOutService> factory = null;
        IServiceContractUniqueTypeOutService serviceProxy             = null;
        UniqueType uniqueType = null;

        try
        {
            // *** SETUP *** \\
            binding      = new BasicHttpBinding();
            factory      = new ChannelFactory <IServiceContractUniqueTypeOutService>(binding, new EndpointAddress(Endpoints.ServiceContractAsyncUniqueTypeOut_Address));
            serviceProxy = factory.CreateChannel();

            ManualResetEvent waitEvent = new ManualResetEvent(false);

            // *** EXECUTE *** \\
            // This delegate will execute when the call has completed, which is how we get the result of the call.
            AsyncCallback callback = (iar) =>
            {
                serviceProxy.EndRequest(out uniqueType, iar);
                waitEvent.Set();
            };

            IAsyncResult ar = serviceProxy.BeginRequest(message, callback, null);

            // *** VALIDATE *** \\
            Assert.True(waitEvent.WaitOne(ScenarioTestHelpers.TestTimeout), "AsyncCallback was not called.");
            Assert.True((uniqueType.stringValue == message),
                        String.Format("The 'stringValue' field in the instance of 'UniqueType' was not as expected. expected {0} but got {1}", message, uniqueType.stringValue));

            // *** CLEANUP *** \\
            ((ICommunicationObject)serviceProxy).Close();
            factory.Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
        }
    }
Exemplo n.º 7
0
 public QuickLinkNavigate(string columnName, Func <object> valueFactory, UniqueType unique = UniqueType.Single, object queryName = null) :
     this(columnName, (object)valueFactory, unique, queryName)
 {
 }
Exemplo n.º 8
0
 public void Request(string stringRequest, ref UniqueType uniqueTypeResponse)
 {
     uniqueTypeResponse.stringValue = stringRequest;
 }
Exemplo n.º 9
0
 public void Request(string stringRequest, out UniqueType uniqueTypeResponse)
 {
     uniqueTypeResponse             = new UniqueType();
     uniqueTypeResponse.stringValue = stringRequest;
 }
Exemplo n.º 10
0
    public static void ServiceContract_TypedProxy_SyncOperation_UniqueTypeRefArg()
    {
        string message = "Hello";
        BasicHttpBinding binding = null;
        ChannelFactory<IServiceContractUniqueTypeRefSyncService> factory = null;
        IServiceContractUniqueTypeRefSyncService serviceProxy = null;
        UniqueType uniqueType = new UniqueType();

        try
        {
            // *** SETUP *** \\
            binding = new BasicHttpBinding();
            factory = new ChannelFactory<IServiceContractUniqueTypeRefSyncService>(binding, new EndpointAddress(Endpoints.ServiceContractSyncUniqueTypeRef_Address));
            serviceProxy = factory.CreateChannel();

            // *** EXECUTE *** \\
            serviceProxy.Request(message, ref uniqueType);

            // *** VALIDATE *** \\
            Assert.True((uniqueType.stringValue == message),
                String.Format("The value of the 'stringValue' field in the UniqueType instance was not as expected. expected {0} but got {1}", message, uniqueType.stringValue));

            // *** CLEANUP *** \\
            ((ICommunicationObject)serviceProxy).Close();
            factory.Close();
        }
        finally
        {
            // *** ENSURE CLEANUP *** \\
            ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
        }
    }
Exemplo n.º 11
0
 public void Request(string stringRequest, ref UniqueType uniqueTypeResponse)
 {
     uniqueTypeResponse.stringValue = stringRequest;
 }
Exemplo n.º 12
0
 public void Request(string stringRequest, out UniqueType uniqueTypeResponse)
 {
     uniqueTypeResponse = new UniqueType();
     uniqueTypeResponse.stringValue = stringRequest;
 }