public void can_create_room_type() { var eventNamespace = "Administration.EventModel.Events"; var eventAssembly = "Administration"; var settings = ConnectionSettings.Create() .SetDefaultUserCredentials(new UserCredentials("admin", "changeit")) .KeepReconnecting() .KeepRetrying() //.UseConsoleLogger() .Build(); var conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113)); conn.ConnectAsync().Wait(); var repo = new SimpleRepo(conn, eventNamespace, eventAssembly); var roomSvc = new AdminSvc(repo); var roomTypeId = Guid.NewGuid(); roomSvc.Handle(new AddRoomType(roomTypeId, "King", "big bed room")); var room = repo.Load <RoomType>(roomTypeId); Assert.Equal(roomTypeId, ((IEventSource)room).Id); }
public void TestMethod1() { var svc = new AdminSvc(); var obj = new Admin { Name = "admin", Pwd = "admin", AddTime = DateTime.Now, EditTime = DateTime.Now, Remark = "Default" }; svc.Add(obj); var list = svc.GetAll(); //var res = svc.Check("admin", "admin1"); Assert.IsTrue(1 == 1); }
static void Main(string[] args) { //Bootstrap var settings = ConnectionSettings.Create() .SetDefaultUserCredentials(new UserCredentials("admin", "changeit")) .KeepReconnecting() .KeepRetrying() //.UseConsoleLogger() .Build(); var conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1113)); conn.ConnectAsync().Wait(); var eventNamespace = "Administration.EventModel.Events"; var eventAssembly = "Administration"; var repo = new SimpleRepo(conn, eventNamespace, eventAssembly); var roomTypeRm = new RoomTypeReader(() => conn, repo.Deserialize); var mainBus = new SimpleBus(); var adminSvc = new AdminSvc(repo); mainBus.Subscribe <AddRoomType>(adminSvc); mainBus.Subscribe <AddRoom>(adminSvc); var view = new ConsoleView(); var controller = new Controller(view, mainBus); roomTypeRm.Subscribe(model => view.RoomSummaries = model); view.Redraw(); roomTypeRm.Start(); controller.StartCommandLoop(); Console.WriteLine("press enter to exit"); Console.ReadLine(); }