Пример #1
0
        public void TestMethod1()
        {
            MockRepository mock = new MockRepository();

            IBuildEngine engine = MockRepository.GenerateStub <IBuildEngine>();

            //engine.Expect(s => s.LogMessageEvent(Arg<BuildMessageEventArgs>.Is.Anything));
            //mock.ReplayAll();

            engine.Stub(s => s.LogMessageEvent(Arg <BuildMessageEventArgs> .Is.Anything)).IgnoreArguments().WhenCalled(x =>
            {
                var evt = x.Arguments[0] as BuildMessageEventArgs;
                Console.WriteLine(evt.Message);
            });

            engine.Stub(s => s.LogWarningEvent(Arg <BuildWarningEventArgs> .Is.Anything)).IgnoreArguments().WhenCalled(x =>
            {
                var evt = x.Arguments[0] as BuildWarningEventArgs;
                Console.WriteLine(evt.Message);
            });

            engine.Stub(s => s.LogErrorEvent(Arg <BuildErrorEventArgs> .Is.Anything)).IgnoreArguments().WhenCalled(x =>
            {
                var evt = x.Arguments[0] as BuildErrorEventArgs;
                Console.WriteLine(evt.Message);
            });

            engine.LogMessageEvent(new BuildMessageEventArgs("test", "test", "test", MessageImportance.High));
            //mock.VerifyAll();

            Assert.AreNotEqual("", Environment.GetEnvironmentVariable("VisualStudioVersion"));

            //engine.Stub(s => s.ProjectFileOfTaskNode).Return("hulla");

            var validator = new ValidateOfficeAppManifest();

            validator.BuildEngine       = engine;
            validator.ManifestFilePaths = new[] { @"C:\projects\kr-addin\OutlookAddin\bin\Debug\app.publish\OfficeAppManifests\OutlookAddinManifest.xml" };
            validator.WebProjectPaths   = new string[] { @"C:\projects\kr-addin\OutlookAddinWeb\OutlookAddinWeb.csproj" };
            validator.ProjectMode       = SharePointProjectMode.MailApp.ToString();
            Assert.IsNotNull(validator.Log);

            var res = validator.Execute();
        }