Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 /// <summary>
 /// Writes the operation result.
 /// </summary>
 /// <param name="testItem"></param>
 public void WriteTestResult(Testing.CSpecTestItem testItem)
 {
     if (testItem.TestSucceed)
         WriteLine(formatter.SuccessResultColor, testItem.Results, true);
     else
         WriteLine(formatter.ErrorResultColor, testItem.Results, true);
 }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     world = new World();
     Testing t = new Testing();
     t.playerTesting();
     t.eggTesting();
     program = new Program();
     program.startMenu();
 }
        public void SetAzureServiceProjectTestsStorageTestsEmptyFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths    = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings           settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows <ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, null, string.Empty, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "StorageAccountName"));
            }
        }
Ejemplo n.º 4
0
        public void SetAzureServiceProjectTestsLocationEmptyFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows <ArgumentException>(() => new SetAzureServiceProjectCommand().SetAzureServiceProjectProcess(string.Empty, null, null, null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Location"));
            }
        }
Ejemplo n.º 5
0
 public override void CheckQueue()
 {
     if (!queue.IsEmpty() && !GetComponent <ActionExecutor>().Executing&& character.IsFree() && receivingQueue.IsEmpty())
     {
         Action action = queue.Remove();
         if (action.Status != Status.ResendSent)
         {
             Testing.WriteToLog(transform.name, transform.name + " is executing action: " + Testing.GetActionInfo(action));
         }
         character.currentAction = action;
         StartCoroutine(Execute(action));
     }
 }
        public void ThrowsForUnknownEnvironment()
        {
            Mock <ICommandRuntime>        commandRuntimeMock = new Mock <ICommandRuntime>();
            RemoveAzureEnvironmentCommand cmdlet             = new RemoveAzureEnvironmentCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                Name           = "test2"
            };

            Testing.AssertThrows <KeyNotFoundException>(
                () => cmdlet.ExecuteCmdlet(),
                string.Format(Resources.EnvironmentNotFound, "test2"));
        }
Ejemplo n.º 7
0
        public void IgnoresAddingPublicEnvironment()
        {
            Mock <ICommandRuntime>     commandRuntimeMock = new Mock <ICommandRuntime>();
            AddAzureEnvironmentCommand cmdlet             = new AddAzureEnvironmentCommand()
            {
                CommandRuntime         = commandRuntimeMock.Object,
                Name                   = EnvironmentName.AzureCloud,
                PublishSettingsFileUrl = "http://microsoft.com"
            };
            int count = GlobalSettingsManager.Instance.GetEnvironments().Count;

            Testing.AssertThrows <Exception>(() => cmdlet.ExecuteCmdlet());
        }
Ejemplo n.º 8
0
        public void ProcessGetWebsiteWithNullSubscription()
        {
            // Test
            var getAzureWebsiteCommand = new GetAzureWebsiteCommand
            {
                CommandRuntime = new MockCommandRuntime()
            };

            AzureSession.SetCurrentContext(null, null, null);


            Testing.AssertThrows <Exception>(getAzureWebsiteCommand.ExecuteCmdlet, Resources.InvalidCurrentSubscription);
        }
Ejemplo n.º 9
0
    public static int Main(string[] args)
    {
        String dataroot = Testing.GetDataRoot();
        String filename = dataroot + "/012345.002.050.dcm";
        String subdir   = "TestReaderUnicode";
        String tmpdir   = Testing.GetTempDirectory(subdir);

        process(filename, tmpdir, "ascii.dcm");
        process(filename, tmpdir, "ê.dcm");
        process(filename, tmpdir, "А.dcm");

        return(0);
    }
        public void AddNewCacheWorkerRoleWithInvalidNamesFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string rootPath = Path.Combine(files.RootPath, "AzureService");
                newServiceCmdlet.NewAzureServiceProcess(files.RootPath, "AzureService");

                foreach (string invalidName in Test.Utilities.Common.Data.InvalidRoleNames)
                {
                    Testing.AssertThrows <ArgumentException>(() => addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(invalidName, 1, rootPath));
                }
            }
        }
        public async Task Active_apprenticeship_with_single_pause_record_gets_pause_dates()
        {
            await Arrange("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.ApprenticeshipsWithPausedDates.Active_Apprenticeship_With_Single_Pause_Record.json");

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.First().Apprenticeship.PausedOn.Should().Be(new DateTime(2019, 1, 1));
            learner.CurrentYearDataLocks.First().Apprenticeship.ResumedOn.Should().Be(new DateTime(2019, 3, 1));
            learner.CurrentYearDataLocks.First().Apprenticeship.CompletionStatus.Should().Be(ApprenticeshipStatus.Active);
        }
Ejemplo n.º 12
0
        public void GetCmpte()
        {
            string arg  = "[test] = [test] + 1";
            var    dict = new Dictionary <string, double>();

            dict.Add("test", 1);

            object actual = 2;

            Testing t = new Testing();

            Assert.AreEqual(t.GetCompute(arg, dict), actual);
        }
Ejemplo n.º 13
0
        public async Task Arrange()
        {
            await Testing.Reset();

            await Testing.Context.AddEntitiesFromJsonResource <EarningEventModel>("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.LearnerWithMissingApprenticeship.EarningEvents.json");

            var dlocks = JsonConvert.DeserializeObject <DataLockEventModel[]>(
                Resources.LoadAsString("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.LearnerWithMissingApprenticeship.Dlock02_DataLocks.json"));

            await Testing.Context.AddEntities(dlocks);

            Testing.TimeProvider.Today.Returns(new DateTime(2019, 8, 1));
        }
Ejemplo n.º 14
0
        public void GlobalSettingsManagerCreateNewInvalidPublishSettingsFileFail()
        {
            foreach (string invalidFileName in Data.InvalidFileName)
            {
                Action <ArgumentException> verification = ex =>
                {
                    Assert.AreEqual <string>(ex.Message, Resources.IllegalPath);
                    Assert.IsFalse(Directory.Exists(Data.AzureAppDir));
                };

                Testing.AssertThrows <ArgumentException>(() => GlobalSettingsManager.CreateFromPublishSettings(Data.AzureAppDir, null, invalidFileName), verification);
            }
        }
Ejemplo n.º 15
0
 public When_oauth_callback_is_received()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAccessToken(It.IsAny <string>())).Returns("12345");
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/callback", with =>
     {
         with.Query("code", "testcode");
     });
 }
Ejemplo n.º 16
0
        public void SetAzureServiceProjectTestsSlotTestsInvalidFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                PowerShellProjectPathInfo paths    = new PowerShellProjectPathInfo(files.RootPath);
                ServiceSettings           settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows <ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(null, "MyHome", null, paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Slot"));
            }
        }
Ejemplo n.º 17
0
 public When_code_can_not_be_exchanged_for_access_token()
 {
     _OAuth = new Mock <IOAuth>(MockBehavior.Strict);
     _OAuth.Setup(d => d.GetAccessToken(It.IsAny <string>())).Returns((string)null);
     _Browser = Testing.CreateBrowser <OAuthModule>(with =>
     {
         with.OAuth(_OAuth);
     });
     _Response = _Browser.Get("/callback", with =>
     {
         with.Query("code", "testcode");
     });
 }
        public async Task Paused_apprenticeship_gets_latest_pause_dates()
        {
            await Arrange("SFA.DAS.IdentifyDataLocks.IntegrationTests.TestData.ApprenticeshipsWithPausedDates.Paused_Apprenticeship.json", true);

            var learner = Testing.CreatePage <LearnerModel>();

            learner.Uln = apprenticeship.Uln.ToString();
            await learner.OnGetAsync();

            learner.CurrentYearDataLocks.First().Apprenticeship.PausedOn.Should().Be(new DateTime(2018, 6, 7));
            learner.CurrentYearDataLocks.First().Apprenticeship.ResumedOn.Should().BeNull();
            learner.CurrentYearDataLocks.First().Apprenticeship.CompletionStatus.Should().Be(ApprenticeshipStatus.Paused);
        }
Ejemplo n.º 19
0
        public void AzureSetDeploymentStorageAccountNameProcessTestsNullFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows <ArgumentException>(() => new SetAzureDeploymentStorageCommand().SetAzureDeploymentStorageProcess(null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "StorageAccountName"));
            }
        }
Ejemplo n.º 20
0
        public virtual void TestSetup()
        {
            powershell = PowerShell.Create();

            foreach (string moduleName in modules)
            {
                powershell.AddScript(string.Format("Import-Module \"{0}\"", Testing.GetTestResourcePath(moduleName)));
            }

            powershell.AddScript("$VerbosePreference='Continue'");
            powershell.AddScript("$DebugPreference='Continue'");
            powershell.AddScript("$ErrorActionPreference='Stop'");
        }
Ejemplo n.º 21
0
        public void AzureSetDeploymentLocationProcessTestsInvalidFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                // Create new empty settings file
                //
                ServicePathInfo paths    = new ServicePathInfo(files.RootPath);
                ServiceSettings settings = new ServiceSettings();
                settings.Save(paths.Settings);

                Testing.AssertThrows <ArgumentException>(() => new SetAzureDeploymentLocationCommand().SetAzureDeploymentLocationProcess("MyHome", paths.Settings), string.Format(Resources.InvalidServiceSettingElement, "Location"));
            }
        }
Ejemplo n.º 22
0
        public void Load()
        {
            List <Sample> _trainning = new List <Sample>();
            List <Sample> _testing   = new List <Sample>();

            string input = Properties.Resources.optdigits_tra;

            // Load optdigits dataset into the DataGridView
            StringReader reader = new StringReader(input);

            char[] buffer = new char[(32 + 1) * 32]; // 32 chars + \n
            int    count  = 0;

            while (true)
            {
                int    read  = reader.ReadBlock(buffer, 0, buffer.Length);
                string label = reader.ReadLine();

                if (read < buffer.Length || label == null)
                {
                    break;
                }

                var sample = ConvertToSample(buffer, label);
                if (count > 1000)
                {
                    _trainning.Add(sample);
                }
                else
                {
                    _testing.Add(sample);
                }

                count++;
            }
            Testing  = _testing;
            Training = _trainning;

            if (IsNormalized)
            {
                double[][] training = Training.GetInstances();

                _mean = training.Mean(dimension: 0);
                _dev  = training.StandardDeviation();

                double[][] testing = Testing.GetInstances();

                Normalize(training);
                Normalize(testing);
            }
        }
Ejemplo n.º 23
0
        private void AssertCachingEnabled(FileSystemHelper files, string serviceName, string rootPath, string webRoleName, string expectedMessage)
        {
            WebRole      webRole      = Testing.GetWebRole(rootPath, webRoleName);
            RoleSettings roleSettings = Testing.GetCloudRole(rootPath, webRoleName);

            AzureAssert.RuntimeUrlAndIdExists(webRole.Startup.Task, Resources.CacheRuntimeValue);

            Assert.AreEqual <string>(Resources.CacheRuntimeVersionKey, webRole.Startup.Task[0].Environment[0].name);
            Assert.AreEqual <string>(enableCacheCmdlet.CacheRuntimeVersion, webRole.Startup.Task[0].Environment[0].value);

            Assert.AreEqual <string>(Resources.EmulatedKey, webRole.Startup.Task[2].Environment[0].name);
            Assert.AreEqual <string>("/RoleEnvironment/Deployment/@emulated", webRole.Startup.Task[2].Environment[0].RoleInstanceValue.xpath);

            Assert.AreEqual <string>(Resources.CacheRuntimeUrl, webRole.Startup.Task[2].Environment[1].name);
            Assert.AreEqual <string>(TestResources.CacheRuntimeUrl, webRole.Startup.Task[2].Environment[1].value);


            AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, serviceName, webRoleName), Path.Combine(Resources.CacheScaffolding, Resources.WebRole));
            AzureAssert.StartupTaskExists(webRole.Startup.Task, Resources.CacheStartupCommand);

            AzureAssert.InternalEndpointExists(webRole.Endpoints.InternalEndpoint,
                                               new InternalEndpoint {
                name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort
            });

            LocalStore localStore = new LocalStore
            {
                name = Resources.CacheDiagnosticStoreName,
                cleanOnRoleRecycle = false
            };

            AzureAssert.LocalResourcesLocalStoreExists(localStore, webRole.LocalResources);

            DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting {
                name = Resources.CacheClientDiagnosticLevelAssemblyName
            };

            AzureAssert.ConfigurationSettingExist(diagnosticLevel, webRole.ConfigurationSettings);

            ConfigConfigurationSetting clientDiagnosticLevel = new ConfigConfigurationSetting {
                name = Resources.ClientDiagnosticLevelName, value = Resources.ClientDiagnosticLevelValue
            };

            AzureAssert.ConfigurationSettingExist(clientDiagnosticLevel, roleSettings.ConfigurationSettings);

            AssertWebConfig(string.Format(@"{0}\{1}\{2}", rootPath, webRoleName, Resources.WebCloudConfig));
            AssertWebConfig(string.Format(@"{0}\{1}\{2}", rootPath, webRoleName, Resources.WebConfigTemplateFileName));

            Assert.AreEqual <string>(expectedMessage, mockCommandRuntime.VerboseStream[0]);
            Assert.AreEqual <string>(webRoleName, (mockCommandRuntime.OutputPipeline[0] as PSObject).GetVariableValue <string>(Parameters.RoleName));
        }
Ejemplo n.º 24
0
        public async Task ShouldGetProfileSortedBySchoolAsc()
        {
            var response = await Testing.Send(new List.Query
            {
                Page      = 1,
                SortField = "school",
                SortBy    = "asc"
            });

            var profile = response.Profiles.FirstOrDefault();

            profile.ShouldNotBeNull();
            profile.Institution.ShouldBe("Arlington");
        }
Ejemplo n.º 25
0
        public async Task ShouldGetProfileSortedByIdAsc()
        {
            var response = await Testing.Send(new List.Query
            {
                Page      = 1,
                SortField = "id",
                SortBy    = "asc"
            });

            var profile = response.Profiles.FirstOrDefault();

            profile.ShouldNotBeNull();
            profile.StaffUniqueId.ShouldBe("0132398");
        }
Ejemplo n.º 26
0
        public void TestRunInstructions()
        {
            var instructions      = Testing.GetTestFileContents("TestInput.txt").Split(Environment.NewLine);
            var instructionRunner = new InstructionRunner(instructions);

            instructionRunner.RunInstructions();
            CollectionAssert.AreEquivalent(
                new Dictionary <string, int> {
                { "a", 1 }, { "b", 0 }, { "c", -10 }
            },
                instructionRunner.Registers);

            Assert.AreEqual(10, instructionRunner.MaxValueHeld);
        }
        public void SetAzureServiceProjectRoleInServiecRootDirectoryFail()
        {
            string serviceName = "AzureService3";

            if (Directory.Exists(serviceName))
            {
                Directory.Delete(serviceName, true);
            }
            CloudServiceProject service = new CloudServiceProject(Directory.GetCurrentDirectory(), serviceName, null);

            service.AddWebRole(Test.Utilities.Common.Data.NodeWebRoleScaffoldingPath);
            cmdlet.RoleName = string.Empty;
            Testing.AssertThrows <InvalidOperationException>(() => cmdlet.ExecuteCmdlet(), Resources.CannotFindServiceRoot);
        }
        public void NewAzureRoleTemplateWithWorkerRole()
        {
            string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "WorkerRoleTemplate");

            addTemplateCmdlet = new NewAzureRoleTemplateCommand()
            {
                Worker = true, CommandRuntime = mockCommandRuntime
            };

            addTemplateCmdlet.ExecuteCmdlet();

            Assert.Equal <string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.Path));
            Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath);
        }
Ejemplo n.º 29
0
        public async Task ShouldGetProfileSortedByYearsOfServiceAsc()
        {
            var response = await Testing.Send(new List.Query
            {
                Page      = 1,
                SortField = "yearsOfService",
                SortBy    = "asc"
            });

            var profile = response.Profiles.FirstOrDefault();

            profile.ShouldNotBeNull();
            profile.YearsOfService.ShouldBe(0);
        }
Ejemplo n.º 30
0
        public void SerializationTestWithGB18030()
        {
            // Setup
            string            outputFileName    = "outputFile.txt";
            ServiceDefinition serviceDefinition = General.DeserializeXmlFile <ServiceDefinition>(
                Testing.GetTestResourcePath("GB18030ServiceDefinition.csdef"));

            // Test
            File.Create(outputFileName).Close();
            General.SerializeXmlFile <ServiceDefinition>(serviceDefinition, outputFileName);

            // Assert
            // If reached this point means the test passed
        }
Ejemplo n.º 31
0
        public void EnableAzureMemcacheRoleProcessOnCacheWorkerRoleFail()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string serviceName   = "AzureService";
                string rootPath      = files.CreateNewService(serviceName);
                string cacheRoleName = "WorkerRole";
                string expected      = string.Format(Resources.InvalidCacheRoleName, cacheRoleName);

                addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);

                Testing.AssertThrows <Exception>(() => enableCacheCmdlet.EnableAzureMemcacheRoleProcess(cacheRoleName, cacheRoleName, rootPath));
            }
        }
Ejemplo n.º 32
0
        public void TestDeploymentSettingsTestNullConfigPathFail()
        {
            string label           = "MyLabel";
            string deploymentName  = service.ServiceName;
            string expectedMessage = string.Format(Resources.InvalidOrEmptyArgumentMessage, Resources.ServiceConfiguration);

            Testing.AssertThrows <ArgumentException>(() => new PublishContext(
                                                         settings,
                                                         packagePath,
                                                         null,
                                                         label,
                                                         deploymentName,
                                                         rootPath), expectedMessage);
        }
        public static void main()
        {
            TestPrimitive();
            TestOverflow();
            ValueTypeDemo();
            TestInitialization();
            TestPackaging();
            TestPakaging1();
            TestPakaging2();
            TestEqualityAndIdentity();
            TestDynamic();
            TestCom();
            TestReflection();

            // Testing
            Testing test = new Testing();
            test.run();
        }
Ejemplo n.º 34
0
        void DoSave()
        {
            var Errorlist = new ArrayList();

            c1TrueDBGrid1.UpdateData();
            
            if (supplier.EditValue==null)
            {
                _ishold = false;
                XtraMessageBox.Show("Please select the supplier","P.O.S",MessageBoxButtons.OK,MessageBoxIcon.Information);
                return;
            }
            if (warehouse.EditValue == null)
            {
                _ishold = false;
                XtraMessageBox.Show("Please select  the warehouse name", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DateTime? dtinv = null;
            if (invdate.EditValue == null || invdate.EditValue.ToString()==string.Empty)
                dtinv = null;
            else
                dtinv = (DateTime?)invdate.EditValue;
            

            string Inv="";
            if (invno.EditValue == null) 
                 Inv=string.Empty;
             else
                Inv = (string)invno.EditValue;

            if (!_ishold)
            {
                if (invno.EditValue==null)
                {
                    XtraMessageBox.Show("Please enter the invoice no", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (invdate.EditValue == null) 
                {
                    XtraMessageBox.Show("Please enter the invoice date", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            
                foreach (var d in this.dataSet1.PURINVDETAIL)
                {
                    string t = "";
                    if (int.Parse(d["qty"].ToString()) == 0)
                    {
                        t = "Quantity not found for item :" + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                    if (decimal.Parse(d["invrate"].ToString()) == 0)
                    {
                        t = "Inv.Rate not found for item :" + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                    if (decimal.Parse(d["sprice"].ToString()) == 0)
                    {
                        t = "Sales price not found for item : " + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                    if (bool.Parse(d["expr"].ToString()) == true && string.IsNullOrEmpty(d["expdate"].ToString()))
                    {
                        t = "Expiry date not found for item :" + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                }
            }
             if (CountInvoiceNo() > 0)
             {
                    XtraMessageBox.Show("Duplicate invoice no found..!,please check the invoice no", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
             }
            if (Errorlist.Count > 0)
            {
                
                var f = new Testing(Errorlist);
                f.ShowDialog();
                return;
            }
            Whid = warehouse.EditValue==null ? 0 : int.Parse(warehouse.EditValue.ToString());
            try
            {
                if (!string.IsNullOrEmpty(_purid))
                {
                    _issaved = true;
                    var dr = this.dataSet1.PURINVMAIN.FindByPURINVID(_purid);
                    if (dr != null)
                    {
                        dr.BeginEdit();
                        dr.SUPID = supplier.EditValue.ToString();
                        dr.SUPNAME = supplier.Text;
                        dr.INVNO = Inv;
                        if(dtinv==null)
                            dr["INVDATE"] = DBNull.Value;
                        else
                            dr["INVDATE"] = dtinv;
                        dr.DUEDAYS = int.Parse(duedays.EditValue.ToString());
                        dr.SPDISCOUNT = decimal.Parse(spdisc.EditValue.ToString());
                        dr.ADJVALUE = decimal.Parse(adjustval.EditValue.ToString());
                        dr.HOLD = _ishold;
                        dr.WHID = Whid;
                        dr.EUSERID = COMMON.Utils.Userid;
                        dr.EDATE = DateTime.Now;
                        dr.NETVALUE = decimal.Parse(netamt.EditValue.ToString());
                        
                        dr.EndEdit();
                        this.purinvmainTableAdapter1.Update(dr);
                    }
                }
                else
                {
                    var InsertQ = new DataSet1TableAdapters.PURINVMAINTableAdapter();
                    //_purid = Convert.ToInt32(InsertQ.InsertQuery(DateTime.Today.Date,
                    //    supplier.EditValue.ToString(),
                    //    supplier.Text,
                    //    Inv,
                    //    dtinv,
                    //    int.Parse(duedays.EditValue.ToString()),
                    //    decimal.Parse(spdisc.EditValue.ToString()),
                    //    decimal.Parse(adjustval.EditValue.ToString()),
                    //    _ishold,
                    //    Whid,
                    //    0,
                    //    COMMON.Utils.Userid,
                    //    DateTime.Now,
                    //    0,
                    //    null,decimal.Parse(netamt.EditValue.ToString())).ToString());
                }
                if (!string.IsNullOrEmpty(_purid))
                {
                    purno.EditValue = _purid;
                    _issaved = true;
                    foreach (DataRow d in this.dataSet1.PURINVDETAIL.Rows)
                    {
                        d["PURINVID"] = _purid;
                    }
                    pURINVDETAILTableAdapter1.Update(this.dataSet1.PURINVDETAIL);
                    if (_ishold)
                    {
                        XtraMessageBox.Show("Invoice holded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        UpdateStock();
                        XtraMessageBox.Show("Invoice recorded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else 
                {
                   XtraMessageBox.Show("Error while saving please try again", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString(), "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 35
0
public void usingTest(Testing p)
{}
Ejemplo n.º 36
0
 public static void Testing(ref Web aretVal)
 {
     aretVal = new Testing();
 }
Ejemplo n.º 37
0
 void DoSave()
 {
     c1TrueDBGrid1.UpdateData();
     if (warehouse.EditValue == null)
     {
         XtraMessageBox.Show("Please select the from warehouse", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     if (tostoreid.EditValue == null)
     {
         XtraMessageBox.Show("Please select the to store", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     DateTime dtinv = DateTime.Parse(invdate.EditValue.ToString());
     ArrayList Errorlist = new ArrayList();
     if (!ishold)
     {
         if (warehouse.EditValue == null)
         {
             XtraMessageBox.Show("Please select the from warehouse", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (tostoreid.EditValue == null)
         {
             XtraMessageBox.Show("Please select the to store", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         foreach (DataRow d in this.dataSet1.ITEMTRANSFERDETAIL)
         {
             string t = "";
             if (int.Parse(d["qty"].ToString()) > 0)
             {
                 if (CheckStock(int.Parse(d["stockid"].ToString()), int.Parse(d["qty"].ToString())))
                 {
                     t = "Sufficent stock not found for item :" + GetItemname((d["ITEMID"].ToString()));
                     Errorlist.Add(t);
                 }
             }
             if (decimal.Parse(d["sprice"].ToString()) == 0)
             {
                 t = "Sales price not found for item : " + GetItemname((d["ITEMID"].ToString()));
                 Errorlist.Add(t);
             }
         }
     }
     if (Errorlist.Count > 0)
     {
         var f = new Testing(Errorlist);
         f.ShowDialog();
         return;
     }
     try
     {
         if (purid > 0)
         {
             issaved = true;
             var dr = this.dataSet1.ITEMTRANSFERMAIN.FindByTRANID(purid);
             if (dr != null)
             {
                 dr.BeginEdit();
                 dr.FRMSTOREID = int.Parse(warehouse.EditValue.ToString());
                 dr.TOSTOREID =tostoreid.EditValue.ToString();
                 dr.HOLD = ishold;
                 dr.EUSERID = COMMON.Utils.Userid;
                 dr.EDATE = DateTime.Now;
                 dr.TOTVALUE = decimal.Parse(netamt.EditValue.ToString());
                 dr.TOTITEMS = this.dataSet1.ITEMTRANSFERDETAIL.Rows.Count;
                 dr.EndEdit();
                 this.iTEMTRANSFERDETAILTableAdapter.Update(dr);
             }
         }
         else
         {
             var InsertQ = new DataSet1TableAdapters.ITEMTRANSFERMAINTableAdapter();
             purid = Convert.ToInt32(InsertQ.InsertQuery(int.Parse(warehouse.EditValue.ToString()),
                 tostoreid.EditValue.ToString(),
                 DateTime.Today.Date,
                 COMMON.Utils.Userid,
                 DateTime.Now,
                 ishold,         
                 0,
                 null , decimal.Parse(netamt.EditValue.ToString()),this.dataSet1.ITEMTRANSFERDETAIL.Rows.Count).ToString());
         }
         if (purid > 0)
         {
             textBox1.Text = purid.ToString();
             issaved = true;
             foreach (DataRow d in this.dataSet1.ITEMTRANSFERDETAIL)
             {
                 d["TRANID"] = purid;
             }
             iTEMTRANSFERDETAILTableAdapter.Update(this.dataSet1.ITEMTRANSFERDETAIL);
             if (ishold)
             {
                 XtraMessageBox.Show("Invoice holded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 UpdateStock();
                 GenerateFiles();
                 XtraMessageBox.Show("Invoice recorded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             this.posMenu1.SaveButtonEnabled = false;
         }
         else
         {
             XtraMessageBox.Show("Error while saving please try again", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString(), "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 38
0
 public void SendObject(IPEndPoint connection, Testing.TestClass testobject)
 {
     LogFile.WriteLine("testobject name: " + testobject.name);
 }
 public void Initialize(Testing newGameManager)
 {
     rB = GetComponent<Rigidbody>();
     navUpdateCounter = Random.Range(50, 150);
     gameManager = newGameManager;
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Writes the operation name.
 /// </summary>
 /// <param name="testItem"></param>
 public void WriteTestName(Testing.CSpecTestItem testItem)
 {
     WriteLine(formatter.NameColor, testItem.Name, true);
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Writes the operation description.
 /// </summary>
 /// <param name="testItem"></param>
 public void WriteTestDescription(Testing.CSpecTestItem testItem)
 {
     WriteLine(formatter.DescriptionColor, testItem.Description, true);
 }
Ejemplo n.º 42
0
        void DoSave()
        {
            c1TrueDBGrid1.UpdateData();
            if (supplier.EditValue == null)
            {
                ishold = false;
                XtraMessageBox.Show("Please select the supplier", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (warehouse.EditValue == null)
            {
                ishold = false;
                XtraMessageBox.Show("Please select  the warehouse name", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DateTime? dtinv = null;
            if (invdate.EditValue == null)
                dtinv = null;
            else
                dtinv = (DateTime?)invdate.EditValue;
            ArrayList Errorlist = new ArrayList();
            string Inv = "";
            if (invno.EditValue == null)
                Inv = string.Empty;
            else
                Inv = (string)invno.EditValue;
            if (!ishold)
            {
                if (invno.EditValue == null)
                {
                    XtraMessageBox.Show("Please enter the invoice no", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (invdate.EditValue == null)
                {
                    XtraMessageBox.Show("Please enter the invoice date", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                foreach (DataRow d in this.dataSet1.RETURNDETAIL)
                {
                    string t = "";
                    if (int.Parse(d["qty"].ToString()) == 0)
                    {
                        t = "Quantity not found for item :" + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                    if (string.IsNullOrEmpty(d["bonusqty"].ToString()))
                    {
                        d["bonusqty"] = 0;
                    }
                    if (int.Parse(d["qty"].ToString()) > 0)
                    {
                        if (int.Parse(d["bonusqty"].ToString()) == 0)
                        {
                                if (CheckStock(int.Parse(d["stockid"].ToString()), int.Parse(d["qty"].ToString())))
                                {
                                    t = "Sufficent stock not found for item :" + GetItemname(d["ITEMID"].ToString());
                                    Errorlist.Add(t);
                                }
                        }
                        else if(int.Parse(d["bonusqty"].ToString())> 0) 
                        {
                            if (CheckStock(int.Parse(d["stockid"].ToString()), (int.Parse(d["qty"].ToString())) + int.Parse(d["bonusqty"].ToString())))
                            {
                                t = "Sufficent stock not found for item :" + GetItemname(d["ITEMID"].ToString());
                                Errorlist.Add(t);
                            }
                        }
                    }
                    if (decimal.Parse(d["invrate"].ToString()) == 0)
                    {
                        t = "Inv.Rate not found for item :" + GetItemname((d["ITEMID"].ToString()));
                        Errorlist.Add(t);
                    }
                    if (decimal.Parse(d["sprice"].ToString()) == 0)
                    {
                        t = "Sales price not found for item : " + GetItemname(d["ITEMID"].ToString());
                        Errorlist.Add(t);
                    }
                }
            }
            if (invno.EditValue != null)
            {
                int t = 0;
                var ta = new DataSet1TableAdapters.RETURNMASTTableAdapter();
                if (purid > 0)
                {
                    t = (int)ta.GetInvoiceCountWithHold(supplier.EditValue.ToString(), invno.EditValue.ToString(), purid);
                }
                else
                {
                    t = (int)ta.GetInvoiceCount(supplier.EditValue.ToString(), invno.EditValue.ToString());
                }
                if (t > 0)
                {
                    XtraMessageBox.Show("Duplicate invoice no found..!,please check the invoice no", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            if (Errorlist.Count > 0)
            {
                var f = new Testing(Errorlist);
                f.ShowDialog();
                return;
            }
            if (warehouse.EditValue == null)
                whid = 0;
            else
                whid = int.Parse(warehouse.EditValue.ToString());
            try
            {
                if (purid > 0)
                {
                    issaved = true;
                    var dr = this.dataSet1.RETURNMAST.FindByRETURNID(purid);
                    if (dr != null)
                    {
                        dr.BeginEdit();
                        dr.SUPID = supplier.EditValue.ToString();
                        dr.SUPNAME = supplier.Text;
                        dr.INVNO = Inv;
                        if (dtinv == null)
                            dr["INVDATE"] = DBNull.Value;
                        else
                            dr["INVDATE"] = dtinv;
                        dr.SPDISCOUNT = decimal.Parse(spdisc.EditValue.ToString());
                        dr.ADJVALUE = decimal.Parse(adjustval.EditValue.ToString());
                        dr.HOLD = ishold;
                        dr.WHID = whid;
                        dr.EUSERID = COMMON.Utils.Userid; 
                        dr.EDATE = DateTime.Now;
                        dr.EndEdit();
                        this.rETURNDETAILTableAdapter.Update(dr);
                    }
                }
                else
                {
                    var InsertQ = new DataSet1TableAdapters.RETURNMASTTableAdapter();
                    purid = Convert.ToInt32(InsertQ.InsertQuery(DateTime.Today.Date,
                        supplier.EditValue.ToString(),
                        supplier.Text,
                        Inv,
                        dtinv,
                        decimal.Parse(spdisc.EditValue.ToString()),
                        decimal.Parse(adjustval.EditValue.ToString()),
                        decimal.Parse(netamt.EditValue.ToString()),
                        ishold,
                        whid,
                        COMMON.Utils.Userid,
                        DateTime.Now).ToString()); 
                }
                if (purid > 0)
                {
                    purno.EditValue = purid;
                    issaved = true;
                    foreach (DataRow d in this.dataSet1.RETURNDETAIL)
                    {
                        d["RETURNID"] = purid;
                    }
                    rETURNDETAILTableAdapter.Update(this.dataSet1.RETURNDETAIL);
                    if (ishold)
                    {
                        XtraMessageBox.Show("Invoice holded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        UpdateStock();
                        XtraMessageBox.Show("Invoice recorded sucessfully", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                  //  this.posMenu1.SaveButtonEnabled = false;
                }
                else
                {
                    XtraMessageBox.Show("Error while saving please try again", "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }


            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString(), "P.O.S", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }