public void CanAdd_should_throw_exception_if_name_exists() { var patterns_1 = patterns_0.Add(DomainId.NewGuid(), "any", "[a-z]", "Message"); var command = new AddPattern { PatternId = patternId, Name = "any", Pattern = ".*" }; ValidationAssert.Throws(() => GuardAppPatterns.CanAdd(patterns_1, command), new ValidationError("A pattern with the same name already exists.")); }
public void Should_add_pattern() { var patterns_1 = patterns_0.Add(id, "NewPattern", "New Pattern", "Message"); patterns_1[id].Should().BeEquivalentTo(new AppPattern("NewPattern", "New Pattern") with { Message = "Message" });
public void CanAdd_should_throw_exception_if_name_exists() { var patterns_1 = patterns_0.Add(Guid.NewGuid(), "any", "[a-z]", "Message"); var command = new AddPattern { PatternId = patternId, Name = "any", Pattern = ".*" }; Assert.Throws <ValidationException>(() => GuardAppPattern.CanAdd(patterns_1, command)); }
public void Should_add_pattern() { var patterns_2 = patterns_1.Add(id, "NewPattern", "New Pattern", "Message"); patterns_2[id].Should().BeEquivalentTo(new AppPattern("NewPattern", "New Pattern", "Message")); }