Exemplo n.º 1
0
        public void CreatePatch()
        {
            var mapper = new ApiUsersModelMapper();
            var model  = new ApiUsersRequestModel();

            model.SetProperties("A", 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, 1, 1, "A");

            JsonPatchDocument <ApiUsersRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiUsersRequestModel();

            patch.ApplyTo(response);
            response.AboutMe.Should().Be("A");
            response.AccountId.Should().Be(1);
            response.Age.Should().Be(1);
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DisplayName.Should().Be("A");
            response.DownVotes.Should().Be(1);
            response.EmailHash.Should().Be("A");
            response.LastAccessDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Location.Should().Be("A");
            response.Reputation.Should().Be(1);
            response.UpVotes.Should().Be(1);
            response.Views.Should().Be(1);
            response.WebsiteUrl.Should().Be("A");
        }
Exemplo n.º 2
0
        private async Task <ApiUsersResponseModel> CreateRecord()
        {
            var model = new ApiUsersRequestModel();

            model.SetProperties("B", 2, 2, DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 2, "B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", 2, 2, 2, "B");
            CreateResponse <ApiUsersResponseModel> result = await this.Client.UsersCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Exemplo n.º 3
0
        public void MapModelToBO()
        {
            var mapper = new BOLUsersMapper();
            ApiUsersRequestModel model = new ApiUsersRequestModel();

            model.SetProperties("A", 1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", 1, 1, 1, "A");
            BOUsers response = mapper.MapModelToBO(1, model);

            response.AboutMe.Should().Be("A");
            response.AccountId.Should().Be(1);
            response.Age.Should().Be(1);
            response.CreationDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.DisplayName.Should().Be("A");
            response.DownVotes.Should().Be(1);
            response.EmailHash.Should().Be("A");
            response.LastAccessDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Location.Should().Be("A");
            response.Reputation.Should().Be(1);
            response.UpVotes.Should().Be(1);
            response.Views.Should().Be(1);
            response.WebsiteUrl.Should().Be("A");
        }