public EventSaveLoadTests()
		{
			_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

			Directory.CreateDirectory(_root);
			_store = new FileEventStore(_root);
		}
示例#2
0
		public LoadAllTests()
		{
			_root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

			Directory.CreateDirectory(_root);
			_store = new FileEventStore(_root);

			_stamper = new IncrementingStamper();
		}
示例#3
0
        public static void Main(string[] args)
        {
            TimeProvider.Now = () => DateTime.Now;

            var es              = new FileEventStore("events");
            var repo            = new Repository(es);
            var cashbookFactory = new Func <Transaction[], Cashbook>(transactions => new Cashbook(transactions));
            var body            = new Body(repo, cashbookFactory);
            var head            = new Head(body);

            head.Run(args);
        }
示例#4
0
        public MainWindow()
        {
            InitializeComponent();

            TimeProvider.Now = () => DateTime.Now;

            var es              = new FileEventStore("events");
            var repo            = new Repository(es);
            var cashbookFactory = new Func <Transaction[], Cashbook>(transactions => new Cashbook(transactions));
            var body            = new Body(repo, cashbookFactory);

            var viewModel = new MainViewModel(body);

            this.DataContext = viewModel;
        }
示例#5
0
        public IEnumerable <RetrievedEventsWithMetaData> ReadAllEvents(EventStoreOffset startOffset, int maxRecordCount)
        {
            if (!FileEventStore.ExistsValid(_serverFolder, StoreId))
            {
                yield break;
            }

            using (var store = FileEventStore.OpenForReading(_serverFolder, StoreId))
            {
                foreach (var record in store.ReadAll(startOffset, maxRecordCount))
                {
                    yield return(record);
                }
            }
        }
		public void When_writing_an_event_the_format_is_correct()
		{
			var stream = new MemoryStream();

			var fs = Substitute.For<IFileSystem>();
			fs.AppendTo(Arg.Any<string>()).Returns(stream);

			var store = new FileEventStore(fs, "store");

			var e = new FixNameSpelling { AggregateID = Guid.NewGuid(), NewName = "Name", Stamp = DateTime.Now, Sequence = new Sequence(25) };

			using (var writer = store.CreateWriter<Guid>(StreamName))
			{
				writer.SaveEvents(new [] { e });
			}

			var json = Encoding.UTF8.GetString(stream.ToArray()).Trim();

			json.ShouldNotContain("StreamSequence");

		}