public void Should_throw_a_NotFoundException_indicating_the_identifer_could_not_be_found()
 {
     ActualException.ShouldNotBeNull();
     ActualException.ShouldBeExceptionType<NotFoundException>();
     ActualException.Message.ShouldContain("identifier");
     ActualException.Message.ShouldContain("could not be found");
 }
Ejemplo n.º 2
0
        public void And_ReturnsException()
        {
            Exception exception = new Exception();
            ActualException<Exception> sut = new ActualException<Exception>(exception);

            Assert.AreSame(exception, sut.And);
        }
            public void Should_indicate_that_auth_is_a_reserved_physical_schema_name()
            {
                Assert.That(ActualException, Is.Not.Null);

                ActualException.MessageShouldContain(
                    $"Schema '{SystemConventions.AuthSchema}' is reserved for system use.");
            }
Ejemplo n.º 4
0
 public void Should_return_correct_propercase_name_segment_for_provided_assembly_name()
 {
     AssertHelper.All(
         () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(Exception))),
         () => Assert.That(ActualException.Message, Is.EqualTo("The supplied 'aggregateExtensionEntity' was not an aggregate extension."))
         );
 }
Ejemplo n.º 5
0
        public void AndShouldNotBeA_ExceptionIsNotSpecifiedType_ReturnsSelf()
        {
            ActualException<Exception> sut = new ActualException<Exception>(new Exception());

            ActualException<Exception> result = sut.AndShouldNotBeA<InvalidOperationException>();

            Assert.AreSame(sut, result);
        }
Ejemplo n.º 6
0
 public void Should_throw_a_MissingMember_exception_with_missing_members_and_associated_types_listed_in_the_message()
 {
     ActualException.ShouldBeExceptionType <MissingMemberException>();
     ActualException.MessageShouldContain("NonExistingSourcePropertyName");
     ActualException.MessageShouldContain("NonExistingTargetPropertyName");
     ActualException.MessageShouldContain(typeof(EntityWithRoleNamedProperties).FullName);
     ActualException.MessageShouldContain(typeof(RelationshipsAuthorizationContextData).FullName);
 }
Ejemplo n.º 7
0
 public void Should_throw_ArgumentNullException()
 {
     AssertHelper.All(
         () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(ArgumentNullException))),
         () => Assert.That(
             ActualException.Message.Replace(Environment.NewLine, " "),
             Is.EqualTo("Value cannot be null. Parameter name: resourceSchemaProperCaseName")));
 }
Ejemplo n.º 8
0
 public void Should_throw_ArgumentNullException_indicating_resourceName_parameter_cannot_be_null()
 {
     AssertHelper.All(
         () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(ArgumentNullException))),
         () => Assert.That(
             ActualException.Message.Replace(Environment.NewLine, " "),
             Is.EqualTo("Value cannot be null. (Parameter 'resourceName')")));
 }
Ejemplo n.º 9
0
        public void AndShouldNotBeA_ExceptionIsSpecifiedType_FailsWithTypesAreEqualMessage()
        {
            Exception exception = new InvalidOperationException();
            MockFormatter.AreEqual(typeof(InvalidOperationException), typeof(InvalidOperationException), "foo").Returns("bar");
            ActualException<Exception> sut = new ActualException<Exception>(exception);

            EasyAssertionException result = Assert.Throws<EasyAssertionException>(() => sut.AndShouldNotBeA<InvalidOperationException>("foo"));

            Assert.AreEqual("bar", result.Message);
        }
Ejemplo n.º 10
0
 public void Should_throw_Exception()
 {
     AssertHelper.All(
         () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(Exception))),
         () =>
         Assert.That(
             ActualException.Message.Replace(Environment.NewLine, " "),
             Is.EqualTo(
                 @"profileNamespaceBaseChildrenConcreteContext was supplied without a value for profileNamespaceName.")));
 }
            public void Should_throw_exception()
            {
                Assert.That(ActualException, Is.Not.Null);

                ActualException.MessageShouldContain(
                    The <Assembly>()
                    .FullName);

                ActualException.MessageShouldContain("did not contain the expected embedded resource");
            }
Ejemplo n.º 12
0
 public void Should_not_throw_an_error()
 {
     ActualException.ShouldBeNull();
 }
Ejemplo n.º 13
0
            public void Should_throw_an_exception_for_Profiles_that_dont_exist()
            {
                Assert.That(ActualException, Is.Not.Null);

                ActualException.ShouldBeExceptionType <KeyNotFoundException>();
            }
Ejemplo n.º 14
0
 public void Should_throw_an_exception_indicating_the_bag_name_format_is_invalid()
 {
     Assert.That(ActualException, Is.Not.Null);
     ActualException.MessageShouldContain("Supplied extension bag name 'Too_Many_Underscores' did not match the expected format.");
 }
 public void Should_indicate_that_the_secondary_entity_of_the_association_does_not_exist()
 {
     ActualException.MessageShouldContain("schema.TargetEntity");
     ActualException.MessageShouldContain("not found");
 }
 public void Should_throw_a_NotImplementedException_indicating_the_interface_was_not_implemented()
 {
     ActualException.ShouldBeExceptionType <NotImplementedException>();
     ActualException.Message.ShouldContain("did not implement");
 }
 public void Should_throw_an_InvalidOperationException()
 {
     ActualException.ShouldBeOfType <InvalidOperationException>();
 }
Ejemplo n.º 18
0
 public void Should_generate_17576_unique_aliases_before_throwing_an_InvalidOperationException()
 {
     _actualAliases.Count.ShouldBe(26 * 26 * 26);
     ActualException.ShouldBeExceptionType <InvalidOperationException>();
 }
Ejemplo n.º 19
0
 public void Should_NOT_throw_a_NotSupportedException()
 {
     ActualException.ShouldNotBeOfType <NotSupportedException>();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Execute the test case represented by the object, and store execution results and/or outcome.
        /// </summary>
        public override void Execute()
        {
            // User supplied parameters will override internal parameters
            Boolean containsLiterals = ContainsLiterals.HasValue && ContainsLiterals.Value ||
                                       InternalParam.ContainsLiterals.HasValue && InternalParam.ContainsLiterals.Value && !ContainsLiterals.HasValue;
            Boolean singleObjectProj = SingleObjectProjection.HasValue && SingleObjectProjection.Value ||
                                       InternalParam.SingleObjectProjection.HasValue && InternalParam.SingleObjectProjection.Value && !SingleObjectProjection.HasValue;

            SqlEnumerator <dynamic> resultEnumerator = null;

            try
            {
                if (!InternalParam.ContainsLiterals.HasValue && !ContainsLiterals.HasValue)
                {
                    try
                    {
                        resultEnumerator = Db.SQL(Statement, Values).GetEnumerator() as SqlEnumerator <dynamic>;
                        InternalParam.ContainsLiterals = false;
                    }
                    catch (SqlException e)
                    {
                        throw e;
                    }
                    catch (Exception e) // Catches ScErrUnsupportLiteral error
                    {
                        //Console.WriteLine("Execute statement: " + e.Message);
                        // TODO: Match unsupported literal exception, throw otherwise.
                        //       Also removes the need for the SqlException above
                        resultEnumerator = Db.SlowSQL(Statement, Values).GetEnumerator() as SqlEnumerator <dynamic>;
                        InternalParam.ContainsLiterals = true;
                    }
                }
                else if (containsLiterals)
                {
                    resultEnumerator = Db.SlowSQL(Statement, Values).GetEnumerator() as SqlEnumerator <dynamic>;
                }
                else
                {
                    resultEnumerator = Db.SQL(Statement, Values).GetEnumerator() as SqlEnumerator <dynamic>;
                }

                string result;
                if (!InternalParam.SingleObjectProjection.HasValue && !SingleObjectProjection.HasValue)
                {
                    try
                    {
                        result = Utilities.GetResults(resultEnumerator, hasOrderByClause());
                        InternalParam.SingleObjectProjection = false;
                    }
                    catch (NullReferenceException e) // Exception indicating that the result set contains single element rows
                    {
                        //Console.WriteLine("GetResults: " + e.Message);
                        result = Utilities.GetSingleElementResults(resultEnumerator, hasOrderByClause());
                        InternalParam.SingleObjectProjection = true;
                    }
                }
                else if (singleObjectProj)
                {
                    result = Utilities.GetSingleElementResults(resultEnumerator, hasOrderByClause());
                }
                else
                {
                    result = Utilities.GetResults(resultEnumerator, hasOrderByClause());
                }

                ActualResults.Add(result);
                ActualExecutionPlan.Add(resultEnumerator.ToString());
                ActuallyUsesBisonParser.Add(resultEnumerator.IsBisonParserUsed);
            }
            catch (Exception exception) // Catch actual exceptions when executing queries
            {
                //Console.WriteLine("Actual exception: " + exception.Message);
                String exceptionMessage = exception.Message;
                if (exceptionMessage.Contains("\r"))
                {
                    exceptionMessage = exceptionMessage.Substring(0, exceptionMessage.IndexOf("\r"));
                }
                if (exceptionMessage.Contains("\n"))
                {
                    exceptionMessage = exceptionMessage.Substring(0, exceptionMessage.IndexOf("\n"));
                }

                ActualException.Add(exceptionMessage);
            }

            finally
            {
                if (resultEnumerator != null)
                {
                    resultEnumerator.Dispose();
                }
            }
        }
 public void Should_throw_an_exception_with_a_message_identifying_the_missing_entity()
 {
     ActualException.MessageShouldContain("could not be found");
     ActualException.MessageShouldContain("schema.Entity2");
 }
Ejemplo n.º 22
0
 public void Should_throw_an_InvalidOperationException()
 {
     ActualException.ShouldBeOfType <InvalidOperationException>();
     ActualException.MessageShouldContain("no available education organizations");
 }
 public void Should_indicate_that_the_reserved_auth_schema_was_used_by_the_entity()
 {
     ActualException.MessageShouldContain(
         $"Entity 'auth.Entity1' uses the reserved schema '{SystemConventions.AuthSchema}'.");
 }
 public void Should_indicate_that_the_primary_entity_of_the_association_does_not_exist()
 {
     ActualException.MessageShouldContain("primary");
     ActualException.MessageShouldContain("schema.SourceEntity");
     ActualException.MessageShouldContain("could not be found");
 }
Ejemplo n.º 25
0
 public void Should_throw_a_security_exception()
 {
     ActualException.ShouldBeOfType <EdFiSecurityException>();
 }
Ejemplo n.º 26
0
 public void Should_not_generate_an_exception()
 {
     ActualException.ShouldBeNull();
 }
 public void Should_throw_a_NotSupportedException_indicating_the_type_is_not_handled()
 {
     ActualException.ShouldNotBeNull();
     ActualException.ShouldBeExceptionType<NotSupportedException>();
     ActualException.Message.ShouldContain("Unhandled");
 }
Ejemplo n.º 28
0
 public void Should_throw_an_EdFiSecurityException_related_to_the_missing_API_key_context()
 {
     ActualException.ShouldBeExceptionType <EdFiSecurityException>();
     ActualException.MessageShouldContain("API key");
 }
Ejemplo n.º 29
0
 public void Should_throw_an_exception()
 {
     ActualException.ShouldBeExceptionType <ArgumentException>();
 }
 public void Should_throw_argument_null_exception()
 {
     ActualException.ShouldBeOfType <ArgumentNullException>();
 }
Ejemplo n.º 31
0
 public void Should_throw_an_error()
 {
     ActualException.ShouldBeOfType <ArgumentOutOfRangeException>();
 }
 public void Should_indicate_that_the_entity_has_already_been_added()
 {
     ActualException.MessageShouldContain("key has already been added");
 }
 public void Should_indicate_that_the_entity_has_not_been_assigned_to_any_aggregate()
 {
     ActualException.MessageShouldContain("schema.Entity2");
     ActualException.MessageShouldContain("not assigned to any aggregate");
 }