コード例 #1
0
        private ICakeContext GetMoqContext(
            IDictionary <string, bool> hasArgs,
            IDictionary <string, string> argValues)
        {
            var fixture = HelperFixture.CreateFixture();
            var args    = this.GetMoqArguments(hasArgs, argValues);
            var globber = this.GetMoqGlobber(fixture.FileSystem, fixture.Environment);
            var reg     = this.GetMoqRegistry();

            return(this.GetMoqContext(fixture, globber, reg, args));
        }
コード例 #2
0
        private ICakeContext GetMoqContext(
            HelperFixture fixture,
            IGlobber globber,
            IRegistry registry,
            ICakeArguments args)
        {
            var log = new FakeLog();

            var contextMock = new Mock <ICakeContext>();

            contextMock.SetupGet(t => t.FileSystem).Returns(fixture.FileSystem);
            contextMock.SetupGet(t => t.Environment).Returns(fixture.Environment);
            contextMock.SetupGet(t => t.Globber).Returns(globber);
            contextMock.SetupGet(t => t.Log).Returns(log);
            contextMock.SetupGet(t => t.Arguments).Returns(args);
            contextMock.SetupGet(t => t.ProcessRunner).Returns(fixture.ProcessRunner);
            contextMock.SetupGet(t => t.Registry).Returns(registry);
            contextMock.SetupGet(t => t.Tools).Returns(fixture.Tools);

            return(contextMock.Object);
        }