public async Task Handle_WithoutResponse_CreatesUser() { var request = new CreateUserWithoutResponseRequest { User = new UserDto { Name = "TestUser" } }; var response = await Mediator.HandleAsync(request); Assert.IsFalse(response.HasErrors); Assert.AreEqual(1, Context.Set <User>().Count()); var user = Context.Set <User>().FirstOrDefault(); Assert.IsNotNull(user); Assert.AreEqual("TestUser", user.Name); }
public async Task Handle_DefaultWithResponse_CreatesUserAndReturnsDto() { var request = new CreateRequest <User, UserDto, UserGetDto>(new UserDto { Name = "TestUser" }); var response = await Mediator.HandleAsync(request); Assert.IsFalse(response.HasErrors); Assert.AreEqual(1, Context.Set <User>().Count()); Assert.IsNotNull(response.Result); Assert.AreEqual("TestUser", response.Result.Name); Assert.AreEqual(response.Result.Id, Context.Set <User>().First().Id); var requestTest = new CreateUserWithoutResponseRequest(); var kRequest = Key.MakeKeys <CreateUserWithoutResponseRequest, string>(x => x.User.Name); var kEntity = Key.MakeKeys <User, string>(x => x.Name); var selector = SelectorHelpers.BuildSingle <CreateUserWithoutResponseRequest, User>(kRequest[0], kEntity[0]); var test1 = selector.Get <User>()(new CreateUserWithoutResponseRequest()); var test2 = Test(request => user => request.User.Name == user.Name, requestTest); int n = 0; }
public Expression <Func <User, bool> > Test(Func <CreateUserWithoutResponseRequest, Expression <Func <User, bool> > > selectorTest, CreateUserWithoutResponseRequest request) { return(selectorTest(request)); }