Exemple #1
0
        public void CreateUnableToParseNull()
        {
            // Arrange.
            const string serializedTask = "serialized task";
            var          parser         = MockRepository.GenerateStrictMock <ITaskParser>();
            var          store          = MockRepository.GenerateStrictMock <ITaskStore>();
            var          factory        = new TaskFactory(parser, store);

            parser.Expect(p => p.Parse(serializedTask)).Return(null);

            // Act.
            var res = factory.Create(new DateTime(), serializedTask);

            // Assert.
            Assert.IsNull(res);
        }
Exemple #2
0
        public void CreateDelegates()
        {
            // Arrange.
            var          date           = new DateTime(2000, 1, 1);
            const string serializedTask = "serialized task";
            const string taskName       = "task name";
            var          parserResult   = new ParserResult {
                Name = taskName
            };
            var taskVersion = new TaskVersion(date);
            var task        = new Task(taskName);
            var parser      = MockRepository.GenerateStrictMock <ITaskParser>();
            var store       = MockRepository.GenerateStrictMock <ITaskStore>();

            var factory =
                MockRepository.GeneratePartialMock <TaskFactory>(parser, store);

            parser
            .Expect(p => p.Parse(serializedTask))
            .Return(parserResult);
            factory
            .Expect(f => f.New(date, parserResult))
            .Return(taskVersion);
            store
            .Expect(s => s.Save(taskName, taskVersion))
            .Return(task);

            // Act.
            var res = factory.Create(date, serializedTask);

            // Assert.
            parser.VerifyAllExpectations();
            factory.VerifyAllExpectations();
            store.VerifyAllExpectations();
            Assert.AreEqual(task, res);
        }
 public void TestSetup()
 {
     events   = new EventAggregator();
     listener = MockRepository.GenerateStrictMock <ITestListener>();
 }
 public void Setup()
 {
     _applicationContainer          = MockRepository.GenerateStrictMock <IContainer>();
     _provider                      = ContainerProvider.Instance;
     _provider.ApplicationContainer = _applicationContainer;
 }