public IConstraints2ConstraintElement Create(
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ir r,
            Ix x,
            Iz z)
        {
            IConstraints2ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints2ConstraintElement(
                    sIndexElement,
                    tIndexElement,
                    r,
                    x,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Ejemplo n.º 2
0
 public IVarianceIResultElement Calculate(
     IVarianceIResultElementFactory varianceIResultElementFactory,
     ItIndexElement tIndexElement,
     IΛIndexElement ΛIndexElement,
     Il l,
     It t,
     Ist st,
     IVarianceΦ varianceΦ,
     Iz z)
 {
     return(varianceIResultElementFactory.Create(
                tIndexElement,
                ΛIndexElement,
                st.Value
                .Select(w =>
                        varianceΦ.GetElementAtAsdecimal(
                            w.sIndexElement,
                            l.GetElementAt(
                                tIndexElement.Key
                                -
                                w.tIndexElement.Key
                                +
                                (int)Math.Floor(
                                    (decimal)w.tIndexElement.Key
                                    /
                                    (tIndexElement.Key + 1))
                                *
                                t.GetT()),
                            ΛIndexElement)
                        *
                        z.GetElementAtAsint(
                            w.sIndexElement,
                            w.tIndexElement))
                .Sum()));
 }
        public IConstraints1ConstraintElement Create(
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ir r,
            IxHat xHat,
            Iz z)
        {
            IConstraints1ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints1ConstraintElement(
                    sIndexElement,
                    tIndexElement,
                    r,
                    xHat,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(constraintElement);
        }
        public IConstraints8UConstraintElement Create(
            IdIndexElement dIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Iu u,
            Iz z)
        {
            IConstraints8UConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints8UConstraintElement(
                    dIndexElement,
                    sIndexElement,
                    tIndexElement,
                    u,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Ejemplo n.º 5
0
        public IConstraints4ConstraintElement Create(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            Il l,
            It t,
            Ist st,
            IΦHat ΦVHat,
            IIHat IHat,
            Iz z)
        {
            IConstraints4ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints4ConstraintElement(
                    tIndexElement,
                    ΛIndexElement,
                    l,
                    t,
                    st,
                    ΦVHat,
                    IHat,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(constraintElement);
        }
Ejemplo n.º 6
0
        public Constraints6ConstraintElement(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            Il l,
            It t,
            Ist st,
            IΦHat ΦVHat,
            IIHat IHat,
            Iz z)
        {
            Expression LHS = IHat.Value[tIndexElement, ΛIndexElement];

            Expression RHS = Expression.Sum(
                st.Value
                .Select(
                    y =>
                    (double)ΦVHat.GetElementAtAsdecimal(
                        y.sIndexElement,
                        l.GetElementAt(
                            tIndexElement.Key
                            -
                            y.tIndexElement.Key
                            +
                            (int)Math.Floor(
                                (decimal)(y.tIndexElement.Key)
                                /
                                (tIndexElement.Key + 1))
                            *
                            t.GetT()),
                        ΛIndexElement)
                    *
                    z.Value[y.sIndexElement, y.tIndexElement]));

            this.Value = LHS == RHS;
        }
Ejemplo n.º 7
0
        public void TestThatCorrectNumberOfImagesGetsParsed()
        {
            Assert.That(m_Stream, Iz.Not.Null);
            MIMER.IEndCriteriaStrategy endofmessage = new BasicEndOfMessageStrategy();
            var message = new MailReader().ReadMimeMessage(ref m_Stream, endofmessage);

            Assert.That(message.Attachments.Count(a => a.Type.Equals("image")), Iz.EqualTo(105));
        }
Ejemplo n.º 8
0
        public void CanRunAndReturnsUserResultNoMailSent()
        {
            var outParams = RunWorkflow(GetEmailSettings(), GetFilterSettings("EntryType = \"Error\" And EventID = 667"));

            Assert.That(outParams.UserResultMessage, Iz.EqualTo("No events. No mail has been sent from FRENDS Radon."));
            Assert.That(smtpServer.ReceivedEmailCount, Iz.LessThan(1));
            smtpServer.ClearReceivedEmail();
        }
Ejemplo n.º 9
0
        public void MatchComponentsTest()
        {
            string             field   = "Content-Type: Multipart/Mixed;boundary=\"Boundary-00=_T7P340MWKGMMYJ0CCJD0\"";
            ContentTypePattern pattern = new ContentTypePattern();
            Match match = pattern.RegularExpression.Match(field);

            Assert.That(match.Value, Iz.EqualTo("Content-Type: Multipart/Mixed;boundary=\"Boundary-00=_T7P340MWKGMMYJ0CCJD0\""));
        }
Ejemplo n.º 10
0
        public void TestReadNonStandardBoundary()
        {
            Stream           boundaryStream = new MemoryStream(Encoding.ASCII.GetBytes(Strings.NonStandardBoundary));
            IMimeMailMessage message        = m_Reader.ReadMimeMessage(ref boundaryStream, m_EndOfMessageStrategy);

            Assert.That(message, Iz.Not.Null);
            Assert.That(message.Body["text/plain"], Iz.Not.Null);
            Assert.That(message.Body["text/html"], Iz.Not.Null);
            Assert.That(message.Attachments.Count, Iz.GreaterThan(0));
        }
Ejemplo n.º 11
0
        public Constraints8UConstraintElement(
            IdIndexElement dIndexElement,
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Iu u,
            Iz z)
        {
            Expression LHS = z.Value[sIndexElement, tIndexElement];

            Expression RHS = u.Value[sIndexElement, dIndexElement];

            this.Value = LHS <= RHS;
        }
Ejemplo n.º 12
0
        public void CanRunAndReturnsUserResultSuccess()
        {
            const string eventName = "RadonWFTestMessage CanRunAndReturnsUserResultSuccess";

            WriteToLogWithStandardLog(eventName, EventLogEntryType.Error, 666);
            var outParams = RunWorkflow(GetEmailSettings(), GetFilterSettings("EntryType = \"Error\" And EventID = 666"));

            Assert.That(outParams.UserResultMessage, Iz.EqualTo("Mail sent to [email protected]"));
            Assert.That(smtpServer.ReceivedEmailCount, Is.EqualTo(1));
            var body = SmtpSenderTest.ParseMessageBody(smtpServer.ReceivedEmail.Single().Body);

            Assert.That(body, Does.Contain(eventName));
            smtpServer.ClearReceivedEmail();
        }
Ejemplo n.º 13
0
        public void CanReadOtherThanApplicationLog()
        {
            const string eventName = "TestEvent CanReadOtherThanApplicationLog";

            WriteToLogWithCustomLog("TestLog", "TestLogSource", eventName, null);

            var outParams = RunWorkflow(GetEmailSettings(), GetFilterSettings("", "", "TestLog"));

            Assert.That(outParams.UserResultMessage, Iz.EqualTo("Mail sent to [email protected]"));
            Assert.That(smtpServer.ReceivedEmailCount, Is.EqualTo(1));

            var body = SmtpSenderTest.ParseMessageBody(smtpServer.ReceivedEmail.Single().Body);

            Assert.That(body, Does.Contain(eventName));
            smtpServer.ClearReceivedEmail();
        }
        public Constraints1ConstraintElement(
            IsIndexElement sIndexElement,
            ItIndexElement tIndexElement,
            Ir r,
            IxHat xHat,
            Iz z)
        {
            Expression LHS = Expression.Sum(
                r.Value
                .Select(
                    y => xHat.Value[sIndexElement, y, tIndexElement]));

            Expression RHS = z.Value[sIndexElement, tIndexElement];

            this.Value = LHS == RHS;
        }
Ejemplo n.º 15
0
        public void CanReadRemoteEventLog()
        {
            const string eventName     = "TestEvent CanReadRemoteEventLog";
            var          remoteMachine = ConfigurationManager.AppSettings["RemoteMachineName"];

            WriteToLogWithCustomLog("Application", "testSource", eventName, remoteMachine);

            var outParams = RunWorkflow(GetEmailSettings(), GetFilterSettings("EntryType = \"Error\" And EventID = 666", remoteMachine, ""));

            Assert.That(outParams.UserResultMessage, Iz.EqualTo("Mail sent to [email protected]"));
            Assert.That(smtpServer.ReceivedEmailCount, Is.EqualTo(1));

            var body = SmtpSenderTest.ParseMessageBody(smtpServer.ReceivedEmail.Single().Body);

            Assert.That(body, Does.Contain(eventName));
            smtpServer.ClearReceivedEmail();
        }
Ejemplo n.º 16
0
        public Iz Create(
            ImmutableList <IzResultElement> value)
        {
            Iz result = null;

            try
            {
                result = new z(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(result);
        }
Ejemplo n.º 17
0
        public void ThrowsOnTooLong()
        {
            PropertyValueException ex = Assert.Throws <PropertyValueException>(() =>
            {
                using (ISession s = OpenSession())
                {
                    StringClass b = new StringClass();
                    b.StringValue = "0123456789a";
                    s.Save(b);
                    s.Flush();
                }
            });

            Assert.That(ex.Message, Iz.EqualTo("Error dehydrating property value for NHibernate.Test.TypesTest.StringClass.StringValue"));
            Assert.That(ex.InnerException, Iz.TypeOf <HibernateException>());
            Assert.That(ex.InnerException.Message, Iz.EqualTo("The length of the string value exceeds the length configured in the mapping."));
        }
Ejemplo n.º 18
0
        public Iz Create(
            VariableCollection <IsIndexElement, ItIndexElement> value)
        {
            Iz variable = null;

            try
            {
                variable = new z(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(variable);
        }
        public void NhThrowsOnTooLong()
        {
            int maxStringLength       = 4000;
            PropertyValueException ex = Assert.Throws <PropertyValueException>(() =>
            {
                using (ISession s = OpenSession())
                {
                    StringClass b     = new StringClass();
                    b.LongStringValue = new string('x', maxStringLength + 1);
                    s.Save(b);
                    s.Flush();
                }
            });

            Assert.That(ex.Message, Iz.EqualTo("Error dehydrating property value for NHibernate.Test.TypesTest.StringClass.LongStringValue"));
            Assert.That(ex.InnerException, Iz.TypeOf <HibernateException>());
            Assert.That(ex.InnerException.Message, Iz.EqualTo("The length of the string value exceeds the length configured in the mapping/parameter."));
        }
Ejemplo n.º 20
0
        public Iz Create(
            ImmutableList <IzResultElement> value)
        {
            Iz result = null;

            try
            {
                result = new z(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(result);
        }
Ejemplo n.º 21
0
        public Iz Create(
            VariableCollection <IsIndexElement, ItIndexElement> value)
        {
            Iz variable = null;

            try
            {
                variable = new z(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(variable);
        }
 public IVarianceI Calculate(
     IVarianceIResultElementFactory varianceIResultElementFactory,
     IVarianceIFactory varianceIFactory,
     IVarianceIResultElementCalculation varianceIResultElementCalculation,
     Il l,
     It t,
     Ist st,
     ItΛ tΛ,
     IVarianceΦ varianceΦ,
     Iz z)
 {
     return(varianceIFactory.Create(
                tΛ.Value
                .Select(i => varianceIResultElementCalculation.Calculate(
                            varianceIResultElementFactory,
                            i.tIndexElement,
                            i.ΛIndexElement,
                            l,
                            t,
                            st,
                            varianceΦ,
                            z))
                .ToImmutableList()));
 }
Ejemplo n.º 23
0
 public IExpectedValueI Calculate(
     IExpectedValueIResultElementFactory expectedValueIResultElementFactory,
     IExpectedValueIFactory expectedValueIFactory,
     IExpectedValueIResultElementCalculation expectedValueIResultElementCalculation,
     Il l,
     It t,
     Ist st,
     ItΛ tΛ,
     IExpectedValueΦ expectedValueΦ,
     Iz z)
 {
     return(expectedValueIFactory.Create(
                tΛ.Value
                .Select(i => expectedValueIResultElementCalculation.Calculate(
                            expectedValueIResultElementFactory,
                            i.tIndexElement,
                            i.ΛIndexElement,
                            l,
                            t,
                            st,
                            expectedValueΦ,
                            z))
                .ToImmutableList()));
 }
Ejemplo n.º 24
0
        public void TestThatXmlFilesGetsParsed()
        {
            Assert.That(m_Stream, Iz.Not.Null);
            MIMER.IEndCriteriaStrategy endofmessage = new BasicEndOfMessageStrategy();
            var message = new MailReader().ReadMimeMessage(ref m_Stream, endofmessage);

            Assert.That(message.Attachments.Count(a => a.Type.Equals("text") && a.SubType.Equals("xml")), Iz.EqualTo(1));
        }
Ejemplo n.º 25
0
 static int Hi(Iz z)
 {
     return(z.I());
 }
Ejemplo n.º 26
0
 static int Hz(Iz z)
 {
     return(z.H());
 }
Ejemplo n.º 27
0
        public IΦHat Calculate(
            IExpectedValueIResultElementCalculationFactory expectedValueIResultElementCalculationFactory,
            IExpectedValueΦResultElementCalculationFactory expectedValueΦResultElementCalculationFactory,
            IVarianceIResultElementCalculationFactory varianceIResultElementCalculationFactory,
            IVarianceΦResultElementCalculationFactory varianceΦResultElementCalculationFactory,
            IVHatResultElementCalculationFactory VHatResultElementCalculationFactory,
            Iυ2ResultElementCalculationFactory υ2ResultElementCalculationFactory,
            IΦHatResultElementCalculationFactory ΦHatResultElementCalculationFactory,
            IExpectedValueICalculationFactory expectedValueICalculationFactory,
            IExpectedValueΦCalculationFactory expectedValueΦCalculationFactory,
            IMRNBCalculationFactory MRNBCalculationFactory,
            IRNBCalculationFactory RNBCalculationFactory,
            ItStarCalculationFactory tStarCalculationFactory,
            IVarianceICalculationFactory varianceICalculationFactory,
            IVarianceΦCalculationFactory varianceΦCalculationFactory,
            IVHatCalculationFactory VHatCalculationFactory,
            Iυ2CalculationFactory υ2CalculationFactory,
            INormalFactory normalFactory,
            IExpectedValueIResultElementFactory expectedValueIResultElementFactory,
            IExpectedValueΦResultElementFactory expectedValueΦResultElementFactory,
            IVarianceIResultElementFactory varianceIResultElementFactory,
            IVarianceΦResultElementFactory varianceΦResultElementFactory,
            IVHatResultElementFactory VHatResultElementFactory,
            Iυ2ResultElementFactory υ2ResultElementFactory,
            IΦHatResultElementFactory ΦHatResultElementFactory,
            IExpectedValueIFactory expectedValueIFactory,
            IExpectedValueΦFactory expectedValueΦFactory,
            IVarianceIFactory varianceIFactory,
            IVarianceΦFactory varianceΦFactory,
            IVHatFactory VHatFactory,
            Iυ2Factory υ2Factory,
            IΦHatFactory ΦHatFactory,
            Il l,
            It t,
            IΛ Λ,
            IslΛ slΛ,
            Ist st,
            ItΛ tΛ,
            IL L,
            Ip p,
            Iμ μ,
            Iσ σ,
            IΩ Ω,
            Iz z)
        {
            // ExpectedValueΦ
            IExpectedValueΦ expectedValueΦ = expectedValueΦCalculationFactory.Create()
                                             .Calculate(
                expectedValueΦResultElementFactory,
                expectedValueΦFactory,
                expectedValueΦResultElementCalculationFactory.Create(),
                l,
                t,
                slΛ,
                L,
                p,
                μ);

            // VarianceΦ
            IVarianceΦ varianceΦ = varianceΦCalculationFactory.Create()
                                   .Calculate(
                varianceΦResultElementFactory,
                varianceΦFactory,
                varianceΦResultElementCalculationFactory.Create(),
                l,
                t,
                slΛ,
                L,
                p,
                μ,
                σ);

            // ExpectedValueI
            IExpectedValueI expectedValueI = expectedValueICalculationFactory.Create()
                                             .Calculate(
                expectedValueIResultElementFactory,
                expectedValueIFactory,
                expectedValueIResultElementCalculationFactory.Create(),
                l,
                t,
                st,
                tΛ,
                expectedValueΦ,
                z);

            // VarianceI
            IVarianceI varianceI = varianceICalculationFactory.Create()
                                   .Calculate(
                varianceIResultElementFactory,
                varianceIFactory,
                varianceIResultElementCalculationFactory.Create(),
                l,
                t,
                st,
                tΛ,
                varianceΦ,
                z);

            // υ2
            Iυ2 υ2 = υ2CalculationFactory.Create()
                     .Calculate(
                normalFactory,
                υ2ResultElementFactory,
                υ2Factory,
                MRNBCalculationFactory.Create(),
                RNBCalculationFactory.Create(),
                υ2ResultElementCalculationFactory.Create(),
                t,
                Λ,
                Ω,
                expectedValueI,
                varianceI);

            // VHat
            IVHat VHat = VHatCalculationFactory.Create()
                         .Calculate(
                normalFactory,
                VHatResultElementFactory,
                VHatFactory,
                RNBCalculationFactory.Create(),
                tStarCalculationFactory.Create(),
                VHatResultElementCalculationFactory.Create(),
                t,
                Λ,
                expectedValueI,
                varianceI,
                υ2);

            return(this.Calculate(
                       normalFactory,
                       ΦHatResultElementFactory,
                       ΦHatFactory,
                       ΦHatResultElementCalculationFactory.Create(),
                       slΛ,
                       expectedValueΦ,
                       varianceΦ,
                       VHat,
                       υ2));
        }
Ejemplo n.º 28
0
        public void TestParse()
        {
            Assert.IsNotNull(m_Stream);
            MIMER.RFC2045.MailReader   m            = new MailReader();
            MIMER.IEndCriteriaStrategy endofmessage = new BasicEndOfMessageStrategy();

            MIMER.RFC2045.IMimeMailMessage message = m.ReadMimeMessage(ref m_Stream, endofmessage);
            Assert.AreEqual("*****@*****.**", message.To[0].Address);
            Assert.AreEqual("*****@*****.**", message.CarbonCopy[0].Address);
            Assert.AreEqual("Testing the .eml format", message.Subject);
            Assert.AreEqual(3, message.Attachments.Count);
            Assert.That(message.Attachments.Count(x => x.Name != null && x.Name.Equals("cp_bg_black800.gif")), Iz.EqualTo(1));
            System.Net.Mail.MailMessage mailmessage = message.ToMailMessage();
            Assert.IsNull(mailmessage.From);
            Assert.AreEqual("*****@*****.**", mailmessage.CC[0].Address);
            Assert.AreEqual(message.TextMessage, mailmessage.Body);
            Assert.AreEqual(message.Attachments.Count, mailmessage.Attachments.Count);
        }
Ejemplo n.º 29
0
        public void triggersFrontMostObjectWhenObjectsOverlap()
        {
            var messagePromptCoordinator = new MessagePromptCoordinator(prompt.MockObject, messageBox.MockObject);

            var first = factory.CreateMock <GameObject>();

            first.Expects.Any.Method(_ => _.GetComponent <Sprite>()).WillReturn(sprite.MockObject);
            var second = factory.CreateMock <GameObject>();

            second.Expects.Any.Method(_ => _.GetComponent <Sprite>()).WillReturn(sprite.MockObject);

            var back          = new Vector3(0, 0, 0);
            var backTransform = new Transform()
            {
                position = back
            };
            var front          = new Vector3(0, 0, -1);
            var frontTransform = new Transform()
            {
                position = front
            };

            // if you think this looks weird, it is. we can't mock bareback public fields, and Unity is full of them.
            first.MockObject.transform  = backTransform;
            second.MockObject.transform = frontTransform;

            var frontObjectResponse = "front object response";
            var frontObjectAction   = "action2";
            var actionResponses     = new Dictionary <GameObject, ActionResponsePair[]> {
                { first.MockObject, new [] { new ActionResponsePair("action", new[] { "response" }) } },
                { second.MockObject, new [] { new ActionResponsePair(frontObjectAction, new[] { frontObjectResponse }) } }
            };

            using (factory.Ordered()) {
                expectTouchWithinSprite(sprite.MockObject, true);
                expectTouchWithinSprite(sprite.MockObject, false);
                expectTouchWithinSprite(sprite.MockObject, true);
            }

            messagePromptCoordinator.hintWhenTouched(
                GameObject => {
            },
                sensor.MockObject,
                beforeEverything,
                actionResponses
                );

            messagePromptCoordinator.Update(beforeEverything);

            GameObject triggeredObject = null;

            messageBox.Expects.One.Method(_ => _.setMessage("")).With(Is.EqualTo(frontObjectResponse));
            messageBox.Expects.One.Method(_ => _.hide());
            messageBox.Expects.One.Method(_ => _.show());

            prompt.Expects.One.Method(_ => _.setText("")).With(Is.EqualTo(frontObjectAction));
            prompt.Expects.One.Method(_ => _.hide());
            prompt.Expects.One.Method(_ => _.show());

            messagePromptCoordinator.hintWhenTouched(
                gameObject => {
                triggeredObject = gameObject;
            },
                sensor.MockObject,
                afterMessageTime,
                actionResponses
                );

            messageBox.Expects.One.Method(_ => _.hide());
            messagePromptCoordinator.Update(afterMessageTime + MessagePromptCoordinator.promptTime + 0.1f);

            Assert.That(triggeredObject, Iz.EqualTo(second.MockObject));
        }
Ejemplo n.º 30
0
        public void ThenTheValueShouldBe(string paramName, string value)
        {
            Mock <IParameterHelper> paramHelperMoq = (Mock <IParameterHelper>)ScenarioContext.Current["paramHelperMoq"];

            Assert.That(paramHelperMoq.Object.GetParameterValueAsString(paramName), Iz.EqualTo(value));
        }