public void ResponseCodesTest()
        {
            Moq.MockRepository repo = new Moq.MockRepository(Moq.MockBehavior.Strict);

            var headers = new Dictionary<string, string>();
            headers.Add("STATUS", "HTTP/1.1 200 OK");

            var wwwMock = repo.Create<WWW>();
            wwwMock.Setup(w => w.isDone).Returns(true);
            wwwMock.Setup(w => w.responseHeaders).Returns(headers);

            Response resp = new Response(wwwMock.Object);

            Assert.AreEqual(200, resp.StatusCode);
        }
        public ILogger GetDefaultTestLogger()
        {
            MoqRepository = new Moq.MockRepository(Moq.MockBehavior.Default);
            SinkMock = MoqRepository.Create<Sink>();
            SinkMock.CallBase = true;

            var logger = new DiagnosticLogger();

            var config = logger.GetConfigurationClone();

            config.Sinks.Clear();

            config.Sinks.Add(SinkMock.Object);

            logger.ApplyConfiguration(config);

            return logger;
        }
示例#3
0
        public void Initialize()
        {
            var users = new List <User>()
            {
                new User()
                {
                    Username = "******"
                },
                new User()
                {
                    Username = "******"
                }
            };

            m_target = new UserIsNotUniqueSpec(users);
            Moq.MockRepository mockRepo = new Moq.MockRepository(Moq.MockBehavior.Loose);
            DomainMessageHelper.MessageHandler = mockRepo.Create <IMessageHandler>().Object;
        }
示例#4
0
 public void Initialize()
 {
     Moq.MockRepository mockRepo = new Moq.MockRepository(Moq.MockBehavior.Loose);
     DomainMessageHelper.MessageHandler = mockRepo.Create <IMessageHandler>().Object;
 }