public void Can_get_chatMessages() { var firstWishList = new WishList { User = new User(), ChatMessages = { new ChatMessage { Text = "Hello", User = new User() } } }; var secondWishList = new WishList { User = new User(), ChatMessages = { new ChatMessage { User = new User(), Text = "Whatup" } } }; Context.AddRange(firstWishList, secondWishList); Context.SaveChanges(); var result = TestSubject.Handle(new GetMessagesRequest { UserId = 1, WishListId = firstWishList.Id }); result.Messages.Select(m => m.Text).ShouldAllBeEquivalentTo(new[] { "Hello" }); }
public void Can_add_chatMessage() { var user = new User { Name = "Userman" }; Context.Add(user); Context.SaveChanges(); var result = TestSubject.Handle(new AddMessageRequest { Text = "Hello", UserId = user.Id }); result.ShouldBeEquivalentTo(new ChatMessageModel { Text = "Hello", User = new UserModel { Id = user.Id, Name = user.Name } }, o => o.Excluding(m => m.Id)); }
public void Can_read_shared_list() { var bob = new User { Name = "Bob", WishLists = { new WishList() } }; var james = new User { Name = "James" }; context.AddRange(bob, james); context.SaveChanges(); var result = TestSubject.Handle(new GetSharedListRequest { ListId = bob.WishLists.First().Id, UserId = james.Id }); result.Owner.Should().Be("Bob"); }
public void Can_read_my_list() { var mapper = Get <IMapperService>(); mapper.Profiles.Should().NotBeEmpty(); var user = new User { Name = "Bob", WishLists = { new WishList { Title = "My list" } } }; context.Add(user); context.SaveChanges(); var result = TestSubject.Handle(new GetMyListRequest { UserId = user.Id }); result.Title.Should().Be("My list"); }