コード例 #1
0
                public async Task NullUser_Throws()
                {
                    var validator = new UserCreatedRequiredValidator <User>();

                    await Assert.ThrowsAsync <ArgumentNullException>("user", async() =>
                    {
                        await validator.Validate(user: null !);
                    });
コード例 #2
0
                public async Task WhenCalled_Succeeds()
                {
                    var validator = new UserCreatedRequiredValidator <User>();
                    var user      = new User()
                    {
                        Created = DateTimeOffset.UtcNow
                    };

                    await validator.Validate(user);
                }
コード例 #3
0
                public async Task DefaultCreated_Throws()
                {
                    var validator = new UserCreatedRequiredValidator <User>();
                    var user      = new User()
                    {
                        Created = default(DateTimeOffset)
                    };

                    await Assert.ThrowsAsync <ArgumentException>("user", async() =>
                    {
                        await validator.Validate(user);
                    });
                }