public void Deserialize()
 {
     var s = new CustomCommandSerializer().Serialize("White.NonCoreTests.CustomCommands.dll", "IBazCommand", "Foo", new object[] {"bar", 1});
     ICommand customCommand;
     bool result = new CommandSerializer(new CommandAssemblies()).TryDeserializeCommand(s, out customCommand);
     Assert.AreEqual(true, result);
 }
Beispiel #2
0
 public void SetUp()
 {
     commandSerializer = new CustomCommandSerializer();
 }
 public void SetUp()
 {
     commandSerializer = new CustomCommandSerializer();
     var testAutomationPeer = new TestAutomationPeer();
     whitePeer = WhitePeer.CreateForValueProvider(testAutomationPeer, null, () => value, s => value = s);
 }
Beispiel #4
0
 private CustomCommandResponse Execute(ValuePattern valuePattern, string assemblyFile, string typeName, MethodInfo method, object[] arguments)
 {
     var commandSerializer = new CustomCommandSerializer();
     string serializedCommand = commandSerializer.Serialize(new FileInfo(assemblyFile).Name, typeName, method.Name, arguments);
     valuePattern.SetValue(serializedCommand);
     ActionPerformed(Action.WindowMessage);
     string value = valuePattern.Current.Value;
     return new CustomCommandResponse(commandSerializer.ToObject(value));
 }
Beispiel #5
0
        internal virtual CustomCommandResponse Do(string assemblyFile, string typeName, MethodInfo method, object[] arguments)
        {
            var valuePattern = Pattern(ValuePattern.Pattern) as ValuePattern;
            if (valuePattern == null) throw new CustomCommandException(string.Format("{0} does not implement ValuePattern", automationElement.Display()));
            CustomCommandResponse response = Execute(valuePattern, assemblyFile, typeName, method, arguments);
            if (response.IsValidResponse) return response;

            var commandSerializer = new CustomCommandSerializer();
            string serializedAssemblyRequest = commandSerializer.SerializeAssembly(assemblyFile);
            valuePattern.SetValue(serializedAssemblyRequest);

            response = Execute(valuePattern, assemblyFile, typeName, method, arguments);
            valuePattern.SetValue(commandSerializer.SerializeEndSession());
            return response;
        }