public ProductCreated(TenantId tenantId, Issues.ProductId id, string name, string description, ProductManager manager, IssueAssigner assigner) { // TODO: Complete member initialization this.TenantId = tenantId.ToString(); this.ProductId = id.ToString(); this.Name = name.ToString(); this.Description = description.ToString(); this.ProductManager = manager.ToString(); this.IssueAssigner = assigner.ToString(); }
public Issue(TenantId tenantId, IssueId issueId, ProductId productId, string description, string summary, IssueType type) : this() { ApplyChange(new IssueCreated(tenantId, issueId, productId, description, summary, type)); }
static void Main() { //Make sure you start an instance of EventStore before running this!! var credentials = new UserCredentials("admin", "changeit"); var connection = EventStoreConnection.Create( ConnectionSettings.Create(). UseConsoleLogger(). SetDefaultUserCredentials( credentials), new IPEndPoint(IPAddress.Loopback, 1113), "EventStoreShopping"); connection.Connect(); var productUow = new UnitOfWork(); var productRepository = new Repository<Product>( Product.Factory, productUow, connection, new EventReaderConfiguration( new SliceSize(512), new JsonDeserializer(), new PassThroughStreamNameResolver(), new FixedStreamUserCredentialsResolver(credentials))); var tenantId = new TenantId(Guid.NewGuid().ToString()); var productId = new ProductId(); productRepository.Add(productId.ToString(), new Product(tenantId, productId, "dolphin-tuna", "non-dolphin free", new ProductManager(Guid.NewGuid().ToString()), new IssueAssigner(Guid.NewGuid().ToString()))); var product = productRepository.Get(productId.ToString()); List<Issue> issues = new List<Issue>(); var issueId = new IssueId(); issues.Add(product.ReportDefect(issueId, "shit be bad yo", "fo real")); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); DefectStatistics stats1 = new DefectStatistics(issues); var release1 = product.ScheduleRelease("new relased", stats1); var density = release1.CalculateDefectDensity(new KlocMEasurement(10)); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.First().Resolve("cool"); DefectStatistics stats2 = new DefectStatistics(issues); var release2 = product.ScheduleRelease("new relased", stats2); var density2 = release2.CalculateDefectDensity(new KlocMEasurement(10)); var product2 = productRepository.Get(productId.ToString()); var issueIdForProduct2 = new IssueId(); issues.Add(product2.ReportDefect(issueIdForProduct2, "shit be bad yo", "fo real")); issues.Add(product2.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product2.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product2.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); issues.Add(product2.ReportDefect(new IssueId(), "shit be bad yo", "fo real")); ProductDefectivenessRanker ranker = new ProductDefectivenessRanker(issues); ProductDefectiveness mostDefective = ranker.MostDefectiveProductFrom(tenantId); }
public List<ProductDefectiveness> AllDefectiveProductsFrom(TenantId tenantId) { var productIssues = repo.GroupBy(x => x.ProductId.id); int rank = 0; return productIssues .Select(x => new { ProductId = x.Key, NumberOfDefects = x.Count() }) .OrderBy(x => x.NumberOfDefects) .Select(x => new ProductDefectiveness(new ProductId(x.ProductId), ++rank)).ToList(); }
public ProductDefectiveness MostDefectiveProductFrom(TenantId tenantId) { return AllDefectiveProductsFrom(tenantId).Last(); }
Product() { Register<ProductCreated>(e => { _id = new ProductId(e.ProductId); _tenantId = new TenantId(e.TenantId); name = e.Name; description = e.Description; productManager = new ProductManager(e.ProductManager); issueAssigner = new IssueAssigner(e.IssueAssigner); }); }
public Product( TenantId tenantId, ProductId id, string name, string description, ProductManager manager, IssueAssigner assigner) : this() { ApplyChange(new ProductCreated(tenantId, id, name, description, manager, assigner)); }
public IssueCreated( TenantId tenantId1, IssueId issueId1, ProductId productId1, string description1, string summary1, IssueType issueType) { // TODO: Complete member initialization this.tenantId = tenantId1.ToString(); this.issueId = issueId1.ToString(); this.productId = productId1.ToString(); this.description = description1.ToString(); this.summary = summary1.ToString(); this.issueType = issueType.ToString(); }
public ProductDefectiveness MostDefectiveProductFrom(TenantId tenantId) { return(AllDefectiveProductsFrom(tenantId).Last()); }