public void InformationResult001()
        {
            // Arrange
            var parameters = new List <ISearchParameter>
            {
                new RowsParameter <TestDocument>().Configure(10),
                new StartParameter <TestDocument>().Configure(1)
            };
            var      jsonStr    = @"
            {
              ""responseHeader"":{
                ""status"":0,
                ""QTime"":10},
                ""response"":{""numFound"":1000,""start"":0,""maxScore"":1.0}
            }";
            var      jsonObject = JObject.Parse(jsonStr);
            var      result     = new InformationResult <TestDocument>();
            long     documentCount;
            TimeSpan timeToExecution;

            // Act
            ((IConvertJsonObject)result).Execute(parameters, jsonObject);
            documentCount   = result.Data.DocumentCount;
            timeToExecution = result.Data.ElapsedTime;

            // Assert
            Assert.Equal(1000, documentCount);
            Assert.Equal(new TimeSpan(0, 0, 0, 0, 10), timeToExecution);
        }
        public void sdk_Info()
        {
            InformationResult info = eqpt.SystemInformation();

            Console.WriteLine(info.serial);
            Console.WriteLine(info.DeviceModelType);
            Console.WriteLine(info.DeviceModelDescription);
        }
    public void AddResult(string text, float amount)
    {
        InformationResult result = informationPrefab.GetInstance(transform).GetComponent <InformationResult>();

        result.Init();
        result.people.text = text;
        result.amount.text = amount.ToString();
        result.amount.textComponent.text = result.amount.text; //Wouldn't show properly unless i did this
    }
    internal InformationResult GetInformation()
    {
        var content = new InformationResult()
        {
            Version = ConstantsHelpers.Version,
            Build = ConstantsHelpers.Build
        };

        return content;
    }
Ejemplo n.º 5
0
        public void InformationResult004()
        {
            // Arrange
            var parameters = new List <ISearchParameter>();
            var jsonObject = new JObject();
            var result     = new InformationResult <TestDocument>();

            // Act / Assert
            Assert.Throws <UnexpectedJsonFormatException>(() => ((IConvertJsonObject)result).Execute(parameters, jsonObject));
        }
Ejemplo n.º 6
0
        public void InformationResult003()
        {
            // Arrange
            var jsonStr    = @"
            {
                ""response"":{""numFound"":1000,""start"":0,""maxScore"":1.0}
            }";
            var parameters = new List <ISearchParameter>();
            var jsonObject = JObject.Parse(jsonStr);
            var result     = new InformationResult <TestDocument>();

            // Act / Assert
            Assert.Throws <UnexpectedJsonFormatException>(() => ((IConvertJsonObject)result).Execute(parameters, jsonObject));
        }
        public void sdk_set_Time()
        {
            // Define a data/hora qualquer
            DateTime dt = DateTime.Now.AddDays(-73).AddMinutes(-97).AddSeconds(-59);

            Console.WriteLine("Definindo horário para: " + dt.ToString("dd/MM/yyyy HH:mm:ss"));
            eqpt.SetSystemTime(dt);

            // Depois de 3 segundos lê a data/hora atual, que deve estar de 3 a 5 segundos de difereça
            System.Threading.Thread.Sleep(4000);
            InformationResult info = eqpt.SystemInformation();

            Console.WriteLine("Horário lido do equipamento: " + info.CurrentTime.ToString("dd/MM/yyyy HH:mm:ss"));
            double s = info.CurrentTime.Subtract(dt).TotalSeconds;

            Console.WriteLine("Diferença: " + s);
            Assert.IsTrue(s > 3 && s < 5, "Não foi possível ler ou definir o horário");

            // Corrige a data/hora do equipamento
            eqpt.SetSystemTime(DateTime.Now);
        }