Esempio n. 1
0
        public void CheckSuccessNoObjectWithFailureCheck()
        {
            var result = new TestClassWithResultMethod().DoSomethingWithNoObjectToReturn(false);

            if (result is IFailureResult fail)
            {
                Assert.Fail("This result wasn't a failure case!");
            }
        }
Esempio n. 2
0
        public void CheckFailureWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(true);

            if (result is ISuccessResult <TestObjectBeingReturned> success)
            {
                Assert.Fail("This result wasn't a success case!");
            }
        }
Esempio n. 3
0
        public void CheckSuccessWithNullableType()
        {
            var result = new TestClassWithResultMethod().DoSomething(false);

            if (result is ISuccessResult <TestObjectBeingReturned?> success)
            {
                Assert.AreEqual("Some Name", success.Value?.Name);
            }
        }
        public void CheckDisabledWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(TestClassWithResultMethod.Behaviour.Disabled);

            if (result is ISuccessResult <TestObjectBeingReturned> )
            {
                Assert.Fail("This result wasn't a success case!");
            }
        }
Esempio n. 5
0
        public void CheckFailureWithFailureCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(true);

            if (result is IFailureResult fail)
            {
                Assert.AreEqual("Some failure reason", fail.ErrorString);
            }
        }
        public void CheckDisabledIsHandledLikeNormalFailureCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(TestClassWithResultMethod.Behaviour.Disabled);

            if (!(result is IFailureResultFromDisabledExtension))
            {
                Assert.Fail("The result should have indicated the extension was disabled, which should also be treated as a normal failure");
            }
        }
        public void CheckDisabledWithDisabledCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(TestClassWithResultMethod.Behaviour.Disabled);

            if (!(result is IFailureResultFromDisabledExtension <TestObjectBeingReturned>))
            {
                Assert.Fail("The result should have indicated the extension was disabled");
            }
        }
        public void CheckSuccessWithFailureCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(TestClassWithResultMethod.Behaviour.Success);

            if (result is IFailureResult)
            {
                Assert.Fail("This result wasn't a failure case!");
            }
        }
        public void CheckSuccessWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomething(TestClassWithResultMethod.Behaviour.Success);

            if (result is ISuccessResult <TestObjectBeingReturned> success)
            {
                Assert.AreEqual("Some Name", success.Value.Name);
            }
        }
        public void CheckFailureNoObjectWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomethingWithNoObjectToReturn(TestClassWithResultMethod.Behaviour.Failure);

            if (result is ISuccessResult)
            {
                Assert.Fail("This result wasn't a success case!");
            }
        }
        public void CheckFailureNoObjectWithFailureCheck()
        {
            var result = new TestClassWithResultMethod().DoSomethingWithNoObjectToReturn(TestClassWithResultMethod.Behaviour.Failure);

            if (result is IFailureResult fail)
            {
                Assert.AreEqual("Some failure reason", fail.ErrorString);
            }
        }
Esempio n. 12
0
        public void CheckSuccessNoObjectWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomethingWithNoObjectToReturn(false);

            if (result is ISuccessResult success)
            {
                Assert.Pass("This was a success");
            }
            else
            {
                Assert.Fail("This should have been a success");
            }
        }
        public void CheckSuccessNoObjectWithSuccessCheck()
        {
            var result = new TestClassWithResultMethod().DoSomethingWithNoObjectToReturn(TestClassWithResultMethod.Behaviour.Success);

            if (result is ISuccessResult)
            {
                Assert.Pass("Was success");
            }
            else
            {
                Assert.Fail("Was supposed to be success");
            }
        }