Beispiel #1
0
        public void Initialize()
        {
            AspectHelper.CodeGenerated += (sender, args) => Console.WriteLine(args.GeneratedCode);
            this.target = AspectHelper.Wrap <ITestContract>(new TestImplementation());

            TestResultBag.Nullify();
        }
Beispiel #2
0
        public void Mef_Integration_Works()
        {
            TestResultBag.Nullify();

            this.target.ExecuteUnwrapped();

            Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersCalled);
            Assert.IsFalse(TestResultBag.VoidMethodWithNoParametersEntryCalled);
            Assert.IsFalse(TestResultBag.VoidMethodWithNoParametersExitCalled);

            TestResultBag.Nullify();

            this.target.ExecuteWrapped();

            Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersCalled);
            Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersEntryCalled);
            Assert.IsTrue(TestResultBag.VoidMethodWithNoParametersExitCalled);
        }
Beispiel #3
0
        public void Normal_Property_Get_And_Set_Work()
        {
            var value = this.target.NormalProperty;

            Assert.IsTrue(TestResultBag.NormalPropertyGetterCalled);
            Assert.AreEqual(value, TestConstants.NormalPropertyGetValue);
            Assert.AreEqual(TestResultBag.NormalPropertyGetValue, TestConstants.NormalPropertyGetValue);
            Assert.IsTrue(TestResultBag.NormalPropertyEntryCalled);
            Assert.IsTrue(TestResultBag.NormalPropertyExitCalled);

            TestResultBag.Nullify();
            this.target.NormalProperty = TestConstants.NormalPropertySetValue;

            Assert.IsTrue(TestResultBag.NormalPropertySetterCalled);
            Assert.IsTrue(TestResultBag.NormalPropertyEntryCalled);
            Assert.IsTrue(TestResultBag.NormalPropertyExitCalled);
            Assert.AreEqual(TestResultBag.NormalPropertySetValue, TestConstants.NormalPropertySetValue);
        }
Beispiel #4
0
        public void Indexer_Get_And_Set_Work()
        {
            var value = this.target[TestConstants.IndexerParameterValue];

            Assert.IsTrue(TestResultBag.IndexerGetterCalled);
            Assert.AreEqual(value, TestConstants.IndexerGetValue);
            Assert.AreEqual(TestResultBag.IndexerGetValue, TestConstants.IndexerGetValue);
            Assert.IsTrue(TestResultBag.IndexerEntryCalled);
            Assert.IsTrue(TestResultBag.IndexerExitCalled);
            Assert.AreEqual(TestResultBag.IndexerParameterValue, TestConstants.IndexerParameterValue);

            TestResultBag.Nullify();
            this.target[TestConstants.IndexerParameterValue] = TestConstants.IndexerSetValue;

            Assert.IsTrue(TestResultBag.IndexerSetterCalled);
            Assert.IsTrue(TestResultBag.IndexerEntryCalled);
            Assert.IsTrue(TestResultBag.IndexerExitCalled);
            Assert.AreEqual(TestResultBag.IndexerSetValue, TestConstants.IndexerSetValue);
            Assert.AreEqual(TestResultBag.IndexerParameterValue, TestConstants.IndexerParameterValue);
        }
Beispiel #5
0
        public IActionResult ShowResults()
        {
            var modelTests     = new TestRealBagViewModel();
            var firstUserTests = this.testService.GetAllTestsWithOutStuffInIttEditDTO();

            modelTests.ResultBag = mapper.ProjectTo <TestEditDTO>(firstUserTests.AsQueryable());

            var modelResults    = new ResultBagViewModel();
            var secondUserTests = this.userTestsService.GetAllUserTests();

            modelResults.ResultBag = mapper.ProjectTo <ResultsViewModel>(secondUserTests.AsQueryable());

            var model = new TestResultBag();

            model.Test    = modelTests;
            model.Results = modelResults;



            return(View(model));
        }