Ejemplo n.º 1
0
 public Issue(TenantId tenantId, IssueId issueId, ProductId productId, string description, string summary, IssueType type)
     : this()
 {
     ApplyChange(new IssueCreated(tenantId, issueId, productId, description, summary, type));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
     });
 }
Ejemplo n.º 4
0
 public ProductDefectiveness(ProductId productId, int defectCount)
 {
     // TODO: Complete member initialization
     this.productId = productId;
     this.Rank = defectCount;
 }
Ejemplo n.º 5
0
 public Product(
     TenantId tenantId,
     ProductId id,
     string name,
     string description,
     ProductManager manager,
     IssueAssigner assigner)
     : this()
 {
     ApplyChange(new ProductCreated(tenantId, id, name, description, manager, assigner));
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 private void When(IssueCreated e)
 {
     _id = new IssueId(e.issueId);
     ProductId = new ProductId(e.productId);
     _state = State.Pending;
     _type = (IssueType)Enum.Parse(typeof(IssueType), e.issueType);
     _description = e.description;
     _summary = e.summary;
 }
Ejemplo n.º 8
0
 public Issue(TenantId tenantId, IssueId issueId, ProductId productId, string description, string summary, IssueType type)
     : this()
 {
     ApplyChange(new IssueCreated(tenantId, issueId, productId, description, summary, type));
 }
Ejemplo n.º 9
0
 public ProductDefectiveness(ProductId productId, int defectCount)
 {
     // TODO: Complete member initialization
     this.productId = productId;
     this.Rank      = defectCount;
 }