예제 #1
0
        private Capability CreateCapability(CapabilitiyTypes cabType)
        {
            Capability s = null;

            switch (cabType)
            {
            case CapabilitiyTypes.AlexaInterface:
                s = new AlexaInterface();
                break;

            default:
                throw new IndexOutOfRangeException("Unknown CapabilitiyTypes");
            }
            return(s);
        }
예제 #2
0
 private static void TestCapability(Capability capability, Capability endpointCapability)
 {
     Assert.Equal(capability.GetType(), endpointCapability.GetType());
     Assert.Equal(capability.Type, endpointCapability.Type);
     switch (capability.Type)
     {
     case CapabilitiyTypes.AlexaInterface:
         AlexaInterface alexaInterface         = capability as AlexaInterface;
         AlexaInterface endpointAlexaInterface = endpointCapability as AlexaInterface;
         Assert.Equal(alexaInterface.Interface, endpointAlexaInterface.Interface);
         Assert.Equal(alexaInterface.Version, endpointAlexaInterface.Version);
         if (alexaInterface.Properties != null)
         {
             Assert.Equal(alexaInterface.Properties.Supported.Count, endpointAlexaInterface.Properties.Supported.Count);
             for (int i = 0; i < alexaInterface.Properties.Supported.Count; i++)
             {
                 Assert.Equal(alexaInterface.Properties.Supported[i].Name, endpointAlexaInterface.Properties.Supported[i].Name);
             }
             if (alexaInterface.Properties.Retrieveable != null)
             {
                 Assert.Equal(alexaInterface.Properties.Retrieveable, endpointAlexaInterface.Properties.Retrieveable);
             }
             else
             {
                 Assert.Null(endpointAlexaInterface.Properties.Retrieveable);
             }
             if (alexaInterface.Properties.ProactivelyReported != null)
             {
                 Assert.Equal(alexaInterface.Properties.ProactivelyReported, endpointAlexaInterface.Properties.ProactivelyReported);
             }
             else
             {
                 Assert.Null(endpointAlexaInterface.Properties.ProactivelyReported);
             }
         }
         else
         {
             Assert.Null(endpointAlexaInterface.Properties);
         }
         break;
     }
 }