Ejemplo n.º 1
0
 public UpdateResult(Entity entity)
 {
     Entity            = entity;
     Result            = ResultTypes.None;
     CollisionDir      = IntVector2.Zero;
     InteractionEntity = null;
 }
Ejemplo n.º 2
0
        public override ResultTypes DoAction()
        {
            if (childrenNodes == null || childrenNodes.Count == 0)
            {
                return(ResultTypes.FAIL);
            }

            if (index >= childrenNodes.Count)
            {
                Reset();
            }

            ResultTypes resultType = ResultTypes.NONE;

            for (int length = childrenNodes.Count; index < length; ++index)
            {
                resultType = childrenNodes[index].DoAction();
                if (resultType == ResultTypes.FAIL)
                {
                    Reset();
                    return(resultType);
                }
                else if (resultType == ResultTypes.RUNNING)
                {
                    return(resultType);
                }
                else
                {
                    continue;
                }
            }

            Reset();
            return(ResultTypes.SUCCESSFUL);
        }
Ejemplo n.º 3
0
        public void Connect()
        {
            EthSystemConnector connection = new EthSystemConnector(System.Net.IPAddress.Parse(this.IPAddress))
            {
                UserName = "******",
                Password = "",
            };

            this.Sensor = new DataManSystem(connection);
            this.Sensor.DefaultTimeout = 5000;
            this.Sensor.SetKeepAliveOptions(true, 3000, 1000);

            ResultTypes requestedResults = ResultTypes.ReadXml | ResultTypes.Image | ResultTypes.ImageGraphics;

            this.Collector = new ResultCollector(this.Sensor, requestedResults);
            this.Collector.ComplexResultArrived += M_DatamanResultCollector_ComplexResultArrived;

            this.Sensor.Connect();

            try
            {
                this.Sensor.SetResultTypes(requestedResults);
            }
            catch
            {
            }
        }
Ejemplo n.º 4
0
        public async Task FinalBookingWithoutBookingForTimeReturnsNotFoundResult()
        {
            // Arrange
            FlightBookInfo bookInfo = new FlightBookInfo()
            {
                Id        = 3,
                AccountId = 1,
                FlightId  = 1,
                BookTime  = DateTimeOffset.Now,
                SeatBooks = new SeatBook[]
                {
                    new SeatBook()
                    {
                        SeatId           = 2,
                        FlightBookInfoId = 1
                    }
                }
            };

            // Act
            ResultTypes bookResult = await _bookingService.FinalBookAsync(bookInfo.Id.Value, "transaction");

            // Assert
            Assert.AreEqual(ResultTypes.NotFound, bookResult);
        }
Ejemplo n.º 5
0
        public async Task FinalBookingReturnsOkResult()
        {
            // Arrange
            FlightBookInfo bookInfo = new FlightBookInfo()
            {
                Id        = 1,
                AccountId = 1,
                BookType  = BookType.AwaitingPayment,
                FlightId  = 1,
                BookTime  = DateTimeOffset.Now,
                SeatBooks = new SeatBook[]
                {
                    new SeatBook()
                    {
                        SeatId = 1
                    }
                }
            };

            // Act
            ResultTypes bookResult = await _bookingService.FinalBookAsync(bookInfo.Id.Value, "transaction");

            // Assert
            Assert.AreEqual(ResultTypes.Ok, bookResult);
        }
Ejemplo n.º 6
0
 public SystemTestResult(ResultTypes resultType, string category, string message, string link)
 {
     Category   = category;
     ResultType = resultType;
     Message    = message;
     Link       = link;
 }
Ejemplo n.º 7
0
 public ExcelCellInfo()
 {
     this.InfoType = ExcelInfoTypes.NONE;
     ResultType    = ResultTypes.NONE;
     this.RowNum   = 0;
     this.CellNum  = 0;
 }
Ejemplo n.º 8
0
        public async Task UpdatingFlightReturnsOkResult()
        {
            // Arrange
            Flight flight = new Flight()
            {
                Id            = 1,
                FromAirportId = 1,
                ToAirportId   = 2,
                DepartureTime = new DateTimeOffset(
                    new DateTime(2019, 5, 20, 16, 0, 0),
                    new TimeSpan(3, 0, 0)
                    ),
                ArrivalTime = new DateTimeOffset(
                    new DateTime(2019, 5, 20, 17, 0, 0),
                    new TimeSpan(3, 0, 0)
                    ),
                AirplaneId = 1,
            };

            // Act
            ResultTypes addResult = await _flightService.UpdateAsync(flight);

            // Assert
            Assert.AreEqual(ResultTypes.Ok, addResult);
        }
Ejemplo n.º 9
0
        public ExcelCellInfo(ExcelInfoTypes type, ResultTypes resultType)
            : this()
        {
            InfoType = type;

            ResultType = resultType;
        }
Ejemplo n.º 10
0
 public ExcelCellInfo(ExcelInfoTypes type, ResultTypes resultType, string msg)
     : this()
 {
     InfoType   = type;
     ResultType = resultType;
     ResultMsg  = msg;
 }
Ejemplo n.º 11
0
        public async Task <bool> SendTaskCompletedEventAsync(ResultTypes resultType)
        {
            var taskCompletedEventUrl = $"{PlanUrl}/{ProjectId}/_apis/distributedtask/hubs/{HubName}/plans/{PlanId}/events?api-version=2.0-preview.1";

            var body = new
            {
                name   = "TaskCompleted",
                taskId = TaskInstanceId,
                jobId  = JobId,
                result = resultType.ToString().ToLowerInvariant()
            };

            var requestBody = JsonSerializer.Serialize(body);

            try
            {
                var result = await PostDataAsync(taskCompletedEventUrl, requestBody);

                if (!result.IsSuccessStatusCode)
                {
                    Console.WriteLine($"SendTaskCompletedEventAsync failed: {result.StatusCode} - {result.Content}");
                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine($"SendTaskCompletedEventAsync failed: {taskCompletedEventUrl}");
                Console.WriteLine(e.ToString());
                return(false);
            }
        }
Ejemplo n.º 12
0
        public void NakathFinderTest()
        {
            AstroTransitDate date   = new AstroTransitDate(new AstroPlace(), false);
            NakathFinder     finder = new NakathFinder(date, new NakathFinderInput());

            finder.BeneficPlanetPosition      = new int[] { 1, 4, 7, 10, 11, 2 };
            finder.LangnaToConsider           = new EnumRasi[] { EnumRasi.Kanya, EnumRasi.Thula, EnumRasi.Mithuna, EnumRasi.Simha };
            finder.MaleficPlanetPosition      = new int[] { 3, 6, 12 };
            finder.NakathToConsider           = new EnumNakath[] { (EnumNakath)1, (EnumNakath)7, (EnumNakath)11 };
            finder.NakathNumberFromRaviNakath = new int[] { 6, 8 };
            finder.EmptyHousesToConsider      = new int[] { 6, 8 };

            Assert.IsTrue(finder.LagnaMatched() == ResultTypes.TRUE);                       //50
            Assert.IsTrue(finder.BadPlanetInGoodPosition() == ResultTypes.FALSE);           //30
            Assert.IsTrue(finder.EmptyHousesToConsiderMatched() == ResultTypes.FALSE);      //30
            Assert.IsTrue(finder.GoodPlanetInGoodPosition() == ResultTypes.FALSE);          //30
            Assert.IsTrue(finder.MoonIsStrong().Result == ResultTypes.NA);                  //30
            Assert.IsTrue(finder.NakathMatched() == ResultTypes.TRUE);                      //60
            Assert.IsTrue(finder.NakathNumberFromRaviNakathMatched() == ResultTypes.FALSE); //60
            ResultTypes ntWeekDay = finder.GoodNakathThithiWeekDays();                      // 80

            finder.HasGoodYoga();                                                           //60
            finder.GoodThithiWeekDay();                                                     //60
            finder.IsGoodNakath();                                                          //60
            finder.IsGoodThithi();                                                          //30
            finder.IsGoodYoga();                                                            //30
            finder.IsGoodKarna();                                                           //30
            finder.IsGoodDay();                                                             //50
        }
        private int GetResultsCount(XmlDocument xmlDocumentResult, ResultTypes resultType)
        {
            // TODO: Add a more efficient way to get the results count depending on the result type.
            // TODO: Add all the necessasry checks to validate the XML. This is ugly code for now.
            XmlNode resultsNode = GetNextNonWhiteSpaceSibling(xmlDocumentResult.FirstChild);

            return(Convert.ToInt32(resultsNode.Attributes[0].Value));
        }
Ejemplo n.º 14
0
 public UnaryTestResult(int aValue1,
                        int aResult,
                        ResultTypes aType)
 {
     Value1 = aValue1;
     Result = aResult;
     Type   = aType;
 }
Ejemplo n.º 15
0
        public async Task UpdatingNameBeforeIntervalExpirationReturnsInvalidDataResult()
        {
            // Act
            ResultTypes updateResult = await _accountService.UpdateNameAsync("Big", "Bob");

            // Assert
            Assert.AreEqual(ResultTypes.InvalidData, updateResult);
        }
Ejemplo n.º 16
0
 public BitTestResult(int aValue1,
                      int aValue2,
                      int aResult,
                      ResultTypes aType)
 {
     Values = new int[] { aValue1, aValue2 };
     Result = aResult;
     Type   = aType;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Ctor. Creats a result collector instance
 /// </summary>
 /// <param name="aDmSystem">DataMan system to use for getting the result components</param>
 /// <param name="aResultTypes">result types that are required for a complete result</param>
 public ResultCollector(DataManSystem aDmSystem, ResultTypes aResultTypes)
 {
     m_DmSystem    = aDmSystem;
     m_ResultTypes = aResultTypes;
     m_DmSystem.ReadStringArrived    += new ReadStringArrivedHandler(OnReadStringArrived);
     m_DmSystem.ImageGraphicsArrived += new ImageGraphicsArrivedHandler(OnImageGraphicsArrived);
     m_DmSystem.ImageArrived         += new ImageArrivedHandler(OnImageArrived);
     m_DmSystem.XmlResultArrived     += new XmlResultArrivedHandler(OnXmlResultArrived);
 }
Ejemplo n.º 18
0
 /// <summary>Инициализация экземпляра класса <see cref="Player"/></summary>
 /// <param name="order">Номер игрока по порядку</param>
 /// <param name="playerType">Тип игрока</param>
 /// <param name="cellValue">Чем играет игрок (Крестик или Нолик)</param>
 public Player(int order, PlayerTypes playerType, CellValues cellValue)
 {
     this.PlayerType = playerType;
     this.CellValue  = cellValue;
     this.Order      = order;
     this.Result     = ResultTypes.Play;
     History         = new List <Step>();
     Variants        = null;
     NextCell        = null;
 }
Ejemplo n.º 19
0
 public ExpressionTestResult(string aInput,
                             int aResult,
                             ResultTypes aType = ResultTypes.EQUAL,
                             Dictionary <string, int> aVariables = null)
 {
     Input     = aInput;
     Result    = aResult;
     Type      = aType;
     Variables = aVariables ?? new Dictionary <string, int>();
 }
 public GoogleSearchResult(IGoogleSearch googleSearch, int resultsCount, int startedFrom, int resultsPerPage, string query, object queryResult, ResultTypes resultType)
 {
     this.googleSearch   = googleSearch;
     this.resultsCount   = resultsCount;
     this.startedFrom    = startedFrom;
     this.resultsPerPage = resultsPerPage;
     this.query          = query;
     this.queryResult    = queryResult;
     this.resultType     = resultType;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Gets the friendly name of the result that is represented in table format in the database.
        /// </summary>
        /// <param name="resColumn">The result type of the table column</param>
        /// <param name="resRow">The result type of the table row</param>
        /// <returns>User friendly name of result</returns>
        public static string GetFriendlyNameOfTableResult(Result resColumn, ResultTypes resRow)
        {
            if (resRow == ResultTypes.MaximumPressureLineContainer)
            {
                if (resColumn.Event.Event_Type == EventType.Valsalva ||
                    (resColumn.Event.Event_Type == EventType.LeakPointPressure && resColumn.Event.Parent.Event_Type == EventType.Valsalva))
                {
                    switch (resColumn.ResultType)
                    {
                    case ResultTypes.Pves:
                        return(Language.Enum_ResultType_ValsalvaMaxPves);

                    case ResultTypes.Pdet:
                        return(Language.Enum_ResultType_ValsalvaMaxPdet);

                    case ResultTypes.Pabd:
                        return(Language.Enum_ResultType_ValsalvaMaxPabd);
                    }
                }
            }
            else if (resRow == ResultTypes.LeakPointPressureLineContainer)
            {
                if (resColumn.Event.Event_Type == EventType.Valsalva ||
                    (resColumn.Event.Event_Type == EventType.LeakPointPressure && resColumn.Event.Parent.Event_Type == EventType.Valsalva))
                {
                    switch (resColumn.ResultType)
                    {
                    case ResultTypes.Pves:
                        return(Language.Enum_ResultType_ValsalvaLeakPointPressurePves);

                    case ResultTypes.Pdet:
                        return(Language.Enum_ResultType_ValsalvaLeakPointPressurePdet);

                    case ResultTypes.Pabd:
                        return(Language.Enum_ResultType_ValsalvaLeakPointPressurePabd);
                    }
                }
                else if (resColumn.Event.Event_Type == EventType.LeakPointPressure && resColumn.Event.Parent.Event_Type != EventType.Valsalva)
                {
                    switch (resColumn.ResultType)
                    {
                    case ResultTypes.Pves:
                        return(Language.Enum_ResultType_LeakPointPressurePves);

                    case ResultTypes.Pdet:
                        return(Language.Enum_ResultType_LeakPointPressurePdet);

                    case ResultTypes.Pabd:
                        return(Language.Enum_ResultType_LeakPointPressurePabd);
                    }
                }
            }

            return(GetResultFriendlyName(resColumn));
        }
Ejemplo n.º 22
0
        public async Task <ActionResult> DeleteAirplaneSeatTypeAsync(int airplaneId, int seatTypeId)
        {
            ResultTypes deleteResult = await _airplaneService.DeleteAirplaneSeatTypeAsync(airplaneId, seatTypeId);

            if (deleteResult == ResultTypes.NotFound)
            {
                return(NotFound());
            }

            return(Ok());
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 60
        /// </summary>
        /// <returns></returns>
        public ResultTypes ThithiMatched()
        {
            ResultTypes result = (ResultTypes)((ThithiToConsider != null && ThithiToConsider.Length > 0) ?
                                               Convert.ToInt16(ThithiToConsider.Contains(TransitDate.Thithi.Current)) : 2);

            if (result == ResultTypes.FALSE)
            {
                ReasonToMakeInvalid += "-Thithi does not match\r\n";
                IsThisValidResult    = false;
            }
            return(result);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 50
        /// </summary>
        /// <returns></returns>
        public ResultTypes LagnaMatched()
        {
            ResultTypes result = (ResultTypes)((LangnaToConsider != null && LangnaToConsider.Length > 0) ?
                                               Convert.ToInt16(LangnaToConsider.Contains(TransitDate.Horoscope.LagnaRasi.Current)) : 3);

            if (result == ResultTypes.FALSE)
            {
                ReasonToMakeInvalid += "-Lagna does not match \r\n";
                IsThisValidResult    = false;
            }
            return(result);
        }
Ejemplo n.º 25
0
    public override ResultTypes DoAction()
    {
        ResultTypes resultType = ResultTypes.NONE;

        do
        {
            resultType = child.DoAction();
        } while (resultType != ResultTypes.SUCCESSFUL);

        Debug.Log("直到成功装饰节点执行结果为:" + resultType);
        return(resultType);
    }
Ejemplo n.º 26
0
        public async Task DeletingNonexistentAirplaneSeatTypeReturnsNotFoundResult()
        {
            // Arrange
            int airplaneId = 200;
            int seatTypeId = 200;

            // Act
            ResultTypes deleteResult = await _airplaneService.DeleteAirplaneSeatTypeAsync(airplaneId, seatTypeId);

            // Assert
            Assert.AreEqual(ResultTypes.NotFound, deleteResult);
        }
Ejemplo n.º 27
0
        public async Task DeletingAirplaneSeatTypeReturnsOkResult()
        {
            // Arrange
            int airplaneId = 1;
            int seatTypeId = 1;

            // Act
            ResultTypes deleteResult = await _airplaneService.DeleteAirplaneSeatTypeAsync(airplaneId, seatTypeId);

            // Assert
            Assert.AreEqual(ResultTypes.Ok, deleteResult);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 30
        /// </summary>
        /// <returns></returns>
        public CheckResult MoonIsStrong()
        {
            ResultTypes result = ResultTypes.TRUE;

            if (!Input.DoCheckMoonStength)
            {
                return(new CheckResult(string.Empty, result));
            }

            int[] moonNotPos          = new int[] { 6, 8, 12 };
            EnumRelationshipTypes rel = BirthDate.Nakath.RelationshipWith(TransitDate.Moon.Nakatha);

            if (rel == EnumRelationshipTypes.Prathyaari || rel == EnumRelationshipTypes.Vada || rel == EnumRelationshipTypes.Vipath)
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult("Moon ocupy a bad Nakath", ResultTypes.FALSE));
            }
            if (moonNotPos.Contains(TransitDate.Moon.HouseNumber))
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(string.Format("Moon in {0} house of the Trasit Horoscope!", TransitDate.Moon.HouseNumber), ResultTypes.FALSE));
            }
            int moonPlace = moonNotPos.FirstOrDefault(x => BirthDate.Horoscope.RasiHouseList[x - 1].CurrentInt == TransitDate.Moon.Rasi.CurrentInt);

            if (moonPlace > 0)
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(string.Format("Moon in {0} house from the Birth Horoscope!", moonPlace), ResultTypes.FALSE));
            }
            AstroRasi moonRasi = TransitDate.Horoscope.RasiHouseList.FirstOrDefault(x => x.CurrentInt == TransitDate.Moon.Rasi.CurrentInt);
            string    desc     = string.Empty;

            foreach (AstroPlanet planet in moonRasi.Planets)
            {
                if (!planet.DataModel.IsGood)
                {
                    desc += planet.Name + ", ";
                }
            }
            if (!string.IsNullOrEmpty(desc))
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(desc.TrimEnd(',', ' ') + " with Moon", ResultTypes.FALSE));
            }
            // Ignored Bad Plant having Sapthama Drusti on Moon

            return(new CheckResult(string.Empty, ResultTypes.TRUE));
        }
        public IGoogleSearchResult Search(string queryText, int startFrom, ResultTypes resultType)
        {
            string tempResult = RunQuery(queryText, startFrom);

            XmlDocument xmlDocument  = ConvertToXmlDocument(tempResult);
            int         resultsCount = GetResultsCount(xmlDocument, resultType);

            object result = ConvertResult(tempResult, resultType);

            IGoogleSearchResult gsResult = new GoogleSearchResult(this, resultsCount, startFrom, resultsPerPage, queryText, result, resultType);

            return(gsResult);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 30
        /// </summary>
        /// <returns></returns>
        public ResultTypes EmptyHousesToConsiderMatched()
        {
            ResultTypes result = (ResultTypes)((EmptyHousesToConsider != null && EmptyHousesToConsider.Length > 0) ?
                                               Convert.ToInt16(!TransitDate.Horoscope.RasiHouseList.Any(x => x.Planets.Count != 0 &&
                                                                                                        EmptyHousesToConsider.Contains(x.HouseNumber))) : 2);

            if (result == ResultTypes.FALSE)
            {
                ReasonToMakeInvalid += "-Expected empty houses are not empty\r\n";
                IsThisValidResult    = false;
            }
            return(result);
        }
Ejemplo n.º 31
0
 public ResultDef(ResultTypes resultType, FillMode recipeFillMode, int numResults, int startPos = 1, bool block = false)
 {
     ResultType = resultType;
     RecipeFillMode = recipeFillMode;
     NumResults = numResults;
     StartPos = startPos > 0 ? startPos : 1;
     TotalResults = StartPos + NumResults - 1;
     Block = block;
 }