Example #1
0
    public bool PosTest5()
    {
        bool   retVal = true;
        string strA;

        char[] charA;
        string ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest5:normal string trimEnd char[] four");
        try
        {
            strA  = TestLibrary.Generator.GetString(-55, false, c_MINI_STRING_LENGTH, c_MAX_STRING_LENGTH);
            charA = new char[0];
            string strB  = spaceStrings[this.GetInt32(0, spaceStrings.Length)];
            string strA1 = strB + "H" + strB + strA + "D" + strB;
            ActualResult = strA1.TrimEnd(charA);
            if (ActualResult.ToString() != strB + "H" + strB + strA + "D")
            {
                TestLibrary.TestFramework.LogError("009", "normal string trimEnd char[] four ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #2
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string strA;
        string ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest2:normal string trim one");
        try
        {
            strA = TestLibrary.Generator.GetString(-55, false, c_MINI_STRING_LENGTH, c_MAX_STRING_LENGTH);
            string strB  = spaceStrings[this.GetInt32(0, spaceStrings.Length)];
            string strA1 = strB + "H" + strA + "D" + strB;
            ActualResult = strA1.Trim();
            if (ActualResult.ToString() != "H" + strA.ToString() + "D")
            {
                TestLibrary.TestFramework.LogError("003", "normal string trim one when space is (" + strB.ToString() + ") ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #3
0
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();
            ActualResult.ProfileId.Should().Be(_expectedApiResult.ProfileId);
            ActualResult.Uln.Should().Be(_expectedApiResult.Uln);
            ActualResult.LearnerName.Should().Be($"{_expectedApiResult.Firstname} {_expectedApiResult.Lastname}");
            ActualResult.DateofBirth.Should().Be(_expectedApiResult.DateofBirth);
            ActualResult.ProviderDisplayName.Should().Be($"{_expectedApiResult.ProviderName} ({_expectedApiResult.ProviderUkprn})");
            ActualResult.ProviderName.Should().Be(_expectedApiResult.ProviderName);
            ActualResult.ProviderUkprn.Should().Be(_expectedApiResult.ProviderUkprn);

            ActualResult.TlevelTitle.Should().Be(_expectedApiResult.TlevelTitle);
            ActualResult.RegistrationPathwayId.Should().Be(_expectedApiResult.RegistrationPathwayId);
            ActualResult.PathwayDisplayName.Should().Be($"{_expectedApiResult.PathwayName} ({_expectedApiResult.PathwayCode})");
            ActualResult.PathwayName.Should().Be(_expectedApiResult.PathwayName);
            ActualResult.PathwayCode.Should().Be(_expectedApiResult.PathwayCode);
            ActualResult.PathwayGrade.Should().Be(_expectedApiResult.PathwayGrade);
            ActualResult.SpecialismDisplayName.Should().Be($"{_expectedApiResult.SpecialismName} ({_expectedApiResult.SpecialismCode})");
            ActualResult.SpecialismName.Should().Be(_expectedApiResult.SpecialismName);
            ActualResult.SpecialismCode.Should().Be(_expectedApiResult.SpecialismCode);
            ActualResult.SpecialismGrade.Should().Be(_expectedApiResult.SpecialismGrade);

            ActualResult.IsEnglishAndMathsAchieved.Should().Be(_expectedApiResult.IsEnglishAndMathsAchieved);
            ActualResult.HasLrsEnglishAndMaths.Should().Be(_expectedApiResult.HasLrsEnglishAndMaths);
            ActualResult.IsSendLearner.Should().Be(_expectedApiResult.IsSendLearner);
            ActualResult.IndustryPlacementStatus.Should().Be(_expectedApiResult.IndustryPlacementStatus);
            ActualResult.ProviderAddress.Should().BeEquivalentTo(_address);

            // validation properties
            ActualResult.HasPathwayResult.Should().BeTrue();
            ActualResult.IsIndustryPlacementAdded.Should().BeTrue();
            ActualResult.IsLearnerRegistered.Should().BeTrue();
            ActualResult.IsNotWithdrawn.Should().BeFalse();
            ActualResult.IsIndustryPlacementCompleted.Should().BeTrue();
        }
Example #4
0
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();
            ActualResult.PathwayStatus.Should().Be(_expectedApiResult.RegistrationPathwayStatus);
            ActualResult.RequestedBy.Should().Be(_expectedApiResult.RequestedBy);
            ActualResult.RequestedOn.Should().Be(_expectedApiResult.RequestedOn);

            var actualSnapshotDetails = ActualResult.SnapshotDetails;

            actualSnapshotDetails.Should().NotBeNull();
            actualSnapshotDetails.Uln.Should().Be(_expectedSnapshotDetails.Uln);
            actualSnapshotDetails.Name.Should().Be(_expectedSnapshotDetails.Name);
            actualSnapshotDetails.Dateofbirth.Should().Be(_expectedSnapshotDetails.Dateofbirth);
            actualSnapshotDetails.ProviderName.Should().Be(_expectedSnapshotDetails.ProviderName);
            actualSnapshotDetails.TlevelTitle.Should().Be(_expectedSnapshotDetails.TlevelTitle);
            actualSnapshotDetails.Core.Should().Be(_expectedSnapshotDetails.Core);
            actualSnapshotDetails.CoreGrade.Should().Be(_expectedSnapshotDetails.CoreGrade);
            actualSnapshotDetails.Specialism.Should().Be(_expectedSnapshotDetails.Specialism);
            actualSnapshotDetails.SpecialismGrade.Should().Be(_expectedSnapshotDetails.SpecialismGrade);
            actualSnapshotDetails.EnglishAndMaths.Should().Be(_expectedSnapshotDetails.EnglishAndMaths);
            actualSnapshotDetails.IndustryPlacement.Should().Be(_expectedSnapshotDetails.IndustryPlacement);

            var actualSnapshotAddress = ActualResult.SnapshotDetails.ProviderAddress;

            actualSnapshotAddress.Should().NotBeNull();
            actualSnapshotAddress.AddressId.Should().Be(_expectedAddress.AddressId);
            actualSnapshotAddress.OrganisationName.Should().Be(_expectedAddress.OrganisationName);
            actualSnapshotAddress.DepartmentName.Should().Be(_expectedAddress.DepartmentName);
            actualSnapshotAddress.AddressLine1.Should().Be(_expectedAddress.AddressLine1);
            actualSnapshotAddress.AddressLine2.Should().Be(_expectedAddress.AddressLine2);
            actualSnapshotAddress.Town.Should().Be(_expectedAddress.Town);
            actualSnapshotAddress.Postcode.Should().Be(_expectedAddress.Postcode);
        }
Example #5
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string strA;
        string ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest2: empty string ToString()");
        try
        {
            strA         = TestLibrary.Generator.GetString(-55, false, c_MINI_STRING_LENGTH, c_MAX_STRING_LENGTH);
            ActualResult = strA.ToString();
            char[] charStrA   = strA.ToCharArray();
            char[] charActual = ActualResult.ToCharArray();
            for (int i = 0; strA.Length > i; i++)
            {
                if (charStrA[i] != charActual[i])
                {
                    TestLibrary.TestFramework.LogError("001", "normal string ToString() ActualResult is not the ExpectResult");
                    retVal = false;
                    break;
                }
            }
            if (!object.ReferenceEquals(strA, ActualResult))
            {
                TestLibrary.TestFramework.LogError("002", "normal string ToString() ActualResult is not ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("003", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #6
0
 public void Then_Expected_Result_Is_Returned()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.IsSuccess.Should().BeTrue();
     ActualResult.ProfileId.Should().Be(ViewModel.ProfileId);
     ActualResult.Uln.Should().Be(Uln);
 }
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.Uln.Should().Be(_expectedApiResult.Uln);
     ActualResult.LearnerName.Should().Be(_expectedApiResult.LearnerName);
     ActualResult.IsSuccess.Should().Be(_expectedApiResult.IsSuccess);
 }
Example #8
0
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.IsSuccess.Should().Be(ExpectedApiResult.IsSuccess);
     ActualResult.Uln.Should().Be(ExpectedApiResult.Uln);
     ActualResult.ProfileId.Should().Be(ExpectedApiResult.ProfileId);
 }
Example #9
0
        public void Then_Expected_Result_Is_Returned()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.IsSelectedCoreSameAsWithdrawn.Should().BeTrue();
            ActualResult.IsSuccess.Should().BeFalse();
        }
Example #10
0
    public bool PosTest1()
    {
        bool   retVal = true;
        string strA;

        char[] ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest1: empty string ToCharArray");
        try
        {
            strA         = string.Empty;
            ActualResult = strA.ToCharArray();
            char[] Expect = new char[0];
            if (ActualResult.ToString() != Expect.ToString() || ActualResult.Length != 0)
            {
                TestLibrary.TestFramework.LogError("001", "empty string ToCharArray ActualResult is not the ExpectResult");
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #11
0
        private static void CalculateFinalPerformance(ActualResult result, PerformanceComponent component, PerformanceComponent penalizationTarget)
        {
            double?realized = component.Get(result.Performance);

            if (realized == null)
            {
                component.Modify(result.FinalPerformance, null);
            }
            else
            {
                double final = realized.Value;
                foreach (var penalization in result.Penalizations)
                {
                    double?minus = component.Get(penalization.Performance);
                    if (minus != null)
                    {
                        final -= minus.Value;
                    }
                }
                if (final < 0)
                {
                    final = 0;
                }
                if (component == penalizationTarget && result.CardResult == CardResult.Red)
                {
                    final = 0;
                }
                component.Modify(result.FinalPerformance, final);
            }
        }
 public void Then_Expected_UploadAssessmentsResponse_Are_Returned()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.IsSuccess.Should().Be(UploadAssessmentsResponseViewModel.IsSuccess);
     ActualResult.ErrorFileSize.Should().Be(UploadAssessmentsResponseViewModel.ErrorFileSize);
     ActualResult.BlobUniqueReference.Should().Be(UploadAssessmentsResponseViewModel.BlobUniqueReference);
 }
Example #13
0
        public override async Task <ActualResult> Create(Subdivisions item)
        {
            var result = new ActualResult();

            try
            {
                if (item.IdSubordinate == null || item.IdSubordinate == 0)
                {
                    await _dbContext.Subdivisions.AddAsync(new Subdivisions
                    {
                        Name         = item.Name,
                        Abbreviation = item.Abbreviation
                    });
                }
                else
                {
                    await _dbContext.Subdivisions.AddAsync(new Subdivisions
                    {
                        Name          = item.Name,
                        Abbreviation  = item.Abbreviation,
                        IdSubordinate = item.IdSubordinate
                    });
                }
            }
            catch (Exception e)
            {
                return(new ActualResult(e.Message));
            }
            return(result);
        }
Example #14
0
    public bool PosTest2()
    {
        bool   retVal = true;
        string strA;

        char[] charA;
        string ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest2:normal string trimStart char[] one");
        try
        {
            strA = TestLibrary.Generator.GetString(-55, false, c_MINI_STRING_LENGTH, c_MAX_STRING_LENGTH);
            char char1   = this.GetChar(0, c_MINI_STRING_LENGTH);
            char char2   = this.GetChar(c_MINI_STRING_LENGTH, c_MINI_STRING_LENGTH + 68);
            char char3   = this.GetChar(c_MINI_STRING_LENGTH + 68, c_MAX_STRING_LENGTH / 2);
            char charEnd = this.GetChar(c_MAX_STRING_LENGTH / 2, c_MAX_STRING_LENGTH);
            charA = new char[] { char1, char2, char3 };

            string strA1 = char1.ToString() + char3.ToString() + strA + charEnd.ToString() + char1.ToString() + char3.ToString();
            ActualResult = strA1.TrimEnd(charA);
            if (ActualResult.ToString() != char1.ToString() + char3.ToString() + strA.ToString() + charEnd.ToString())
            {
                TestLibrary.TestFramework.LogError("003", "normal string trimEnd char[] one ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.ProfileId.Should().Be(expectedApiResult.ProfileId);
            ActualResult.AssessmentId.Should().Be(expectedApiResult.AssessmentId);
            ActualResult.AssessmentSeriesName.Should().Be(expectedApiResult.AssessmentSeriesName);
        }
Example #16
0
 private static string BuildReportResultNote(ActualResult latestResult)
 {
     if (latestResult.JudgeComment != null)
     {
         return(latestResult.JudgeComment);
     }
     return(string.Join(" ", latestResult.Penalizations.Select(p => p.ShortReason)));
 }
Example #17
0
        public void Then_Expected_Result_Is_Returned()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.IsModified.Should().BeFalse();
            ActualResult.IsCoreNotSupported.Should().BeFalse();
            ActualResult.IsSuccess.Should().BeFalse();
        }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.ProfileId.Should().Be(mockResult.ProfileId);
            ActualResult.Firstname.Should().Be(mockResult.Firstname);
            ActualResult.Lastname.Should().Be(mockResult.Lastname);
        }
Example #19
0
 public double?CalculateFinalPoints(ActualResult result)
 {
     if (result == null || result.FinalPerformance == null || result.FinalPerformance.Points == null)
     {
         return(null);
     }
     return(Math.Round(result.FinalPerformance.Points.Value * Coeficient, 4));
 }
Example #20
0
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.TlevelsToReview.Should().NotBeNull();
     ActualResult.TlevelsToReview.Count().Should().Be(1);
     ActualResult.IsOnlyOneTlevelReviewPending.Should().BeTrue();
     ActualResult.ShowViewReviewedTlevelsLink.Should().BeFalse();
 }
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.ProviderId.Should().Be(ApiClientResponse.Id);
     ActualResult.DisplayName.Should().Be(ApiClientResponse.DisplayName);
     ActualResult.Ukprn.Should().Be(ApiClientResponse.Ukprn);
     ActualResult.Tlevels.Should().BeNullOrEmpty();
 }
Example #22
0
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.PathwayId.Should().Be(ExpectedResult.PathwayId);
     ActualResult.RouteName.Should().Be(ExpectedResult.RouteName);
     ActualResult.PathwayName.Should().Be(ExpectedResult.PathwayName);
     ActualResult.ShowSomethingIsNotRight.Should().Be(ExpectedResult.ShowSomethingIsNotRight);
     ActualResult.ShowQueriedInfo.Should().Be(ExpectedResult.ShowQueriedInfo);
 }
Example #23
0
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();
            ActualResult.IsModified.Should().BeTrue();
            ActualResult.IsSuccess.Should().BeTrue();

            ActualResult.Uln.Should().Be(mockRegDetails.Uln);
            ActualResult.ProfileId.Should().Be(mockRegDetails.ProfileId);
        }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.IsSuccess.Should().Be(UploadResultsResponseViewModel.IsSuccess);
            ActualResult.Stats.Should().NotBeNull();

            ActualResult.Stats.TotalRecordsCount.Should().Be(UploadResultsResponseViewModel.Stats.TotalRecordsCount);
        }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            var actualResult = ActualResult.First();

            actualResult.PathwayId.Should().Be(ExpectedResult.PathwayId);
            actualResult.TlevelTitle.Should().Be(ExpectedTLevelTitle);
        }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.PathwayId.Should().Be(PathwayId);
            ActualResult.ShowMoreTlevelsToReview.Should().Be(true);
            ActualResult.TlevelConfirmationText.Should().Be("T Level details confirmed");
            ActualResult.TlevelTitle.Should().Be("Tlevel Title1");
        }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.IsSuccess.Should().Be(_expectedResult.IsSuccess);
            ActualResult.TotalCount.Should().Be(_expectedResult.TotalCount);
            ActualResult.LrsCount.Should().Be(_expectedResult.LrsCount);
            ActualResult.ModifiedCount.Should().Be(_expectedResult.ModifiedCount);
            ActualResult.SavedCount.Should().Be(_expectedResult.SavedCount);
        }
 public void Then_Returns_Expected_Results()
 {
     ActualResult.Should().NotBeNull();
     ActualResult.DepartmentName.Should().Be(_expectedApiResult.DepartmentName);
     ActualResult.OrganisationName.Should().Be(_expectedApiResult.OrganisationName);
     ActualResult.AddressLine1.Should().Be(_expectedApiResult.AddressLine1);
     ActualResult.AddressLine2.Should().Be(_expectedApiResult.AddressLine2);
     ActualResult.Town.Should().Be(_expectedApiResult.Town);
     ActualResult.Postcode.Should().Be(_expectedApiResult.Postcode);
 }
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();
            ActualResult.IsModified.Should().BeTrue();
            ActualResult.IsSuccess.Should().BeFalse();

            ActualResult.ProfileId.Should().Be(_expectedApiResult.ProfileId);
            ActualResult.Uln.Should().Be(_expectedApiResult.Uln);
            ActualResult.Name.Should().Be(_expectedApiResult.Name);
        }
Example #30
0
        public void Then_Returns_Expected_Results()
        {
            ActualResult.Should().NotBeNull();

            ActualResult.ProfileId.Should().Be(expectedApiResult.ProfileId);
            ActualResult.Uln.Should().Be(expectedApiResult.Uln);
            ActualResult.Name.Should().Be(string.Concat(expectedApiResult.Firstname, " ", expectedApiResult.Lastname));
            ActualResult.ProviderDisplayName.Should().Be($"{expectedApiResult.ProviderName} ({expectedApiResult.ProviderUkprn})");
            ActualResult.PathwayStatus.Should().Be(expectedApiResult.Status);
        }