Beispiel #1
0
        public void ReturnsServerLogFromRequestedServerForSpecificProject()
        {
            // Setup
            IServerSpecifier  serverSpecifier   = new DefaultServerSpecifier("foo");
            IProjectSpecifier projectSpecifier  = new DefaultProjectSpecifier(serverSpecifier, "foo-project");
            string            serverLog         = "server log";
            Hashtable         expectedHashtable = new Hashtable();

            expectedHashtable["log"]            = serverLog;
            expectedHashtable["projectLinks"]   = new IsAnything();
            expectedHashtable["currentProject"] = projectSpecifier.ProjectName;

            IResponse response = new HtmlFragmentResponse("foo");

            requestMock.SetupResult("ServerSpecifier", serverSpecifier);
            requestMock.SetupResult("ProjectName", projectSpecifier.ProjectName);
            requestMock.SetupResult("ProjectSpecifier", projectSpecifier);
            farmServiceMock.ExpectAndReturn("GetServerLog", serverLog, projectSpecifier, null);
            farmServiceMock.ExpectAndReturn("GetProjectStatusListAndCaptureExceptions", new ProjectStatusListAndExceptions(new ProjectStatusOnServer[0], null), serverSpecifier, null);
            viewGeneratorMock.ExpectAndReturn("GenerateView", response, @"ServerLog.vm", new HashtableConstraint(expectedHashtable));

            // Execute
            Assert.AreEqual(response, action.Execute((ICruiseRequest)requestMock.MockInstance));

            VerifyAll();
        }
Beispiel #2
0
    public static int Main()
    {
        IsAnything validDigit;

        validDigit = new IsAnything(Char.IsDigit);

        return(0);
    }
Beispiel #3
0
        /// <summary>
        /// Create an appropriate <see cref="IPredicate"/> given an
        /// abitrary object.
        /// </summary>
        /// <param name="expectation">argument expectation</param>
        /// <returns><see cref="IPredicate"/> that is appropriate for
        /// the specified object</returns>
        public static IPredicate ConvertFrom(object expectation)
        {
            IPredicate predicate = expectation as IPredicate;

            if (predicate == null)
            {
                if (expectation == null)
                {
                    predicate = new IsAnything();
                }
                else
                {
                    predicate = new IsEqual(expectation);
                }
            }
            return(predicate);
        }
Beispiel #4
0
	public static int Main () {
		IsAnything validDigit;
		validDigit = new IsAnything (Char.IsDigit);

		return 0;
	}