Inheritance: NUnit.Framework.Assert
Esempio n. 1
0
        public void IfFormContainsUnknownElements_BuildPostData_ShouldContainOnlyKnownElements()
        {
            //Arrange
            string html = @"
                <html>
                        <body>
                            <form id='form1' action='action' method='put'>
                                <input type='text' name='textbox1' value='textvalue' />
                                <input type='password' name='password1' value='passvalue' />
                                <input type='checkbox' name='checkbox1' value='checkvalue' />
                                <input type='radio' name='radio1' value='radiovalue' />
                                <input type='reset' name='reset1' value='resetvalue' />
                                <input type='file' name='file1' value='filevalue' />
                                <input type='hidden' name='hidden1' value='hiddenvalue' />
                                <input type='submit' name='button1' value='button1' />
                                <input type='search' name='search1' value='search1' />
                                <input type='tel' name='tel1' value='tel1' />
                                <input type='url' name='url1' value='url1' />
                                <input type='email' name='email1' value='email1' />
                                <input type='datetime' name='datetime1' value='datetime1' />
                                <input type='date' name='date1' value='10/10/1981' />
                                <input type='month' name='month1' value='month1' />
                                <input type='week' name='week1' value='week1' />
                                <input type='time' name='time1' value='time1' />
                                <input type='number' name='number1' value='11' />
                            </form>
                        </body>
                    </html>";

            HtmlFormElement form = (HtmlFormElement)HtmlElement.Create(html).ChildElements.Find("form1");

            //Act
            PostDataCollection postData = form.GetPostDataCollection();

            // Assert
            MSAssert.AreEqual("textbox1=textvalue&password1=passvalue&file1=filevalue&hidden1=hiddenvalue&button1=button1&search1=search1&tel1=tel1&url1=url1&email1=email1&datetime1=datetime1&date1=10%2f10%2f1981&month1=month1&week1=week1&time1=time1&number1=11", postData.GetPostDataString());
            MSAssert.AreEqual(15, postData.Count);
        }
Esempio n. 2
0
        public async Task RequestRemoteAsync_ThrowExceptionAtSendMessage_ThrownException()
        {
            var exception = new Exception();
            var GotDevice = new DtDevice();

            // Target Create
            TestDiProviderBuilder builder =
                new TestDiProviderBuilder()
                .AddConfigure("RemoteParameter", "isl.exe --session-code {0}.");

            // Mock : デバイス取得に成功
            SetMock_ReadDevice_Returns(GotDevice, builder);

            // Mock : メッセージ送信時に例外
            SetMock_SendMessage_Thrown(exception, builder);

            var service = builder.Build().GetService <IDeviceService>();
            var request = new RequestRemote();

            var result = await service.RequestRemoteAsync(request);

            Assert.Fail();
        }
Esempio n. 3
0
        public void OuterHtmlPrintsAllInnerTextBetweenTags()
        {
            string html     = @"
                <html>
                    <foo a='a'>
                        text1
                        <bar b='b'></bar>
                        text2
                    </foo>
                </html>
                ";
            string expected = @"
                    <html>
                        <foo a='a'>
                            text1text2
                            <bar b='b'></bar>
                        </foo>
                    </html>";

            HtmlElement element = HtmlElement.Create(Utils.TrimSpaceBetweenTags(html));

            UnitTestAssert.AreEqual(Utils.TrimSpaceBetweenTags(expected), Utils.TrimSpaceBetweenTags(element.GetOuterHtml(false)));
        }
        public void XmlElementTestFileNotFoundTest()
        {
            string location = Assembly.GetExecutingAssembly().Location;

            _XMLElementTest.Path     = Path.GetDirectoryName(location);
            _XMLElementTest.Filename = string.Format("{0}.confug", Path.GetFileName(location));
            _XMLElementTest.ExpectedValues.Add(new XMLElementTest.Attribute {
                Name = "key", Value = "Hello"
            });
            _XMLElementTest.ExpectedValues.Add(new XMLElementTest.Attribute {
                Name = "value", Value = "Everybody"
            });

            try
            {
                _XMLElementTest.Run();
                throw new AssertFailedException("Expected exception was not thrown");
            }
            catch (AssertionException ex)
            {
                Assert.AreEqual("File Not Found", ex.Message);
            }
        }
Esempio n. 5
0
        public void BuildPostData_ReturnsNameValuePairsForInputElements()
        {
            //Arrange
            string html = @"
                <html>
                    <form id='form1'>
                        <div>
                            <input type='text' name='input1' value='value1' />
                            <input type='text' name='input2' value='value2' />                            
                        </div>
                    </form>
                </html>
                ";

            HtmlFormElement form = (HtmlFormElement)HtmlElement.Create(html).ChildElements.Find("form1");

            //Act
            PostDataCollection postData = form.GetPostDataCollection();

            // Assert
            MSAssert.AreEqual("input1=value1&input2=value2", postData.GetPostDataString());
            MSAssert.AreEqual(2, postData.Count);
        }
Esempio n. 6
0
        public void WhenGetPostData_IfSelectHasNoOptions_ShouldNotAddItToPostada()
        {
            //Arrange
            string html = @"
                <html>
                    <form id='form1'>
                        <div>
                            <select name='select1' />
                            <input type='text' name='input1' value='value1' />
                            <input type='submit' name='submit1' value='submit1' />
                        </div>
                    </form>
                </html>
                ";

            HtmlFormElement form = (HtmlFormElement)HtmlElement.Create(html).ChildElements.Find("form1");

            //Act
            PostDataCollection postData = form.GetPostDataCollection();

            // Assert
            MSAssert.AreEqual("input1=value1&submit1=submit1", postData.GetPostDataString());
        }
Esempio n. 7
0
        public void WhenGetPostData_IfMultipleSubmitButtonsAndNoSubmitId_ShouldReturnBothSubmitButtonData()
        {
            //Arrange
            string html = @"
                <html>
                    <form id='form1'>
                        <div>
                            <input type='text' name='input1' value='value1' />
                            <input type='submit' name='submit1' value='submit1' />
                            <input type='submit' name='submit2' value='submit2' />                            
                        </div>
                    </form>
                </html>
                ";

            HtmlFormElement form = (HtmlFormElement)HtmlElement.Create(html).ChildElements.Find("form1");

            //Act
            PostDataCollection postData = form.GetPostDataCollection();

            // Assert
            MSAssert.AreEqual("input1=value1&submit1=submit1&submit2=submit2", postData.GetPostDataString());
        }
        public void RemoveItemCommand_ServicesReternsLocationWeather_RemoveLocationWeatherList()
        {
            _locationSearchServiceMoc
            .Setup(service => service.GetLocationList())
            .Returns(null as IEnumerable <Location>);

            _locationSearchServiceMoc
            .Setup(service => service.DeleteLocationAsync(It.IsAny <string>()))
            .ReturnsAsync(true);

            _weatherServiceMoc
            .Setup(service => service.GetCurrentWeatherByLocationAsync(It.IsAny <string>()))
            .ReturnsAsync(null as IList <Weather>);

            var locationWeatherListViewModel = new LocationWeatherListViewModel(_weatherServiceMoc.Object, _locationSearchServiceMoc.Object);

            locationWeatherListViewModel.LoadItemsCommand.Execute(null);
            locationWeatherListViewModel.RemoveItemCommand.Execute(_locationKyiv.Key);

            var locationWeatherListResult = locationWeatherListViewModel.LocationWeatherList;

            Assert.AreEqual(null, locationWeatherListResult.FirstOrDefault());
        }
Esempio n. 9
0
        public void TestPendingBreakPointLocation()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\DebuggerProject.sln", "BreakpointInfo.py");
                var bpInfo  = project.ProjectItems.Item("BreakpointInfo.py");

                project.GetPythonProject().GetAnalyzer().WaitForCompleteAnalysis(x => true);

                var bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 2);
                Assert.AreEqual("Python", bp.Item(1).Language);
                // FunctionName doesn't get queried for when adding the BP via EnvDTE, so we can't assert here :(
                //Assert.AreEqual("BreakpointInfo.C", bp.Item(1).FunctionName);
                bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 3);
                Assert.AreEqual("Python", bp.Item(1).Language);
                //Assert.AreEqual("BreakpointInfo.C.f", bp.Item(1).FunctionName);
                bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 6);
                Assert.AreEqual("Python", bp.Item(1).Language);
                //Assert.AreEqual("BreakpointInfo", bp.Item(1).FunctionName);
                bp = app.Dte.Debugger.Breakpoints.Add(File: "BreakpointInfo.py", Line: 7);
                Assert.AreEqual("Python", bp.Item(1).Language);
                //Assert.AreEqual("BreakpointInfo.f", bp.Item(1).FunctionName);
            }
        }
        public void JwtGetBrandLogoByBrandIdTest()
        {
            AccountsApi accApi = new AccountsApi();

            if (string.IsNullOrEmpty(testConfig.BrandId))
            {
                CreateBrandTest();
            }

            byte[] brandLogoByteArray = Convert.FromBase64String(testConfig.BrandLogo);

            //Check if C# png just got uploaded
            Stream stream = accApi.GetBrandLogoByType(testConfig.AccountId, testConfig.BrandId, "primary");

            Assert.IsNotNull(stream);

            using (MemoryStream ms = new MemoryStream())
            {
                stream.CopyTo(ms);
                byte[] brandLogofromApi = ms.ToArray();
                Assert.AreEqual(Convert.ToBase64String(brandLogoByteArray), Convert.ToBase64String(brandLogofromApi));
            }
        }
Esempio n. 11
0
        public void SoftAssertAssertFailsFailed()
        {
            var tester = GetBaseTest();

            tester.Setup();
            tester.Log = new FileLogger(string.Empty, $"{Guid.NewGuid()}.txt");
            tester.SoftAssert.AssertFails(() => throw new Exception("broke"), typeof(AggregateException), "one");
            try
            {
                tester.SoftAssert.FailTestIfAssertFailed();
            }
            catch (AggregateException aggregateException)
            {
                MicroAssert.AreEqual(
                    1,
                    aggregateException.InnerExceptions.Count,
                    "Incorrect number of inner exceptions in Soft Assert");
                NUnit.Framework.Assert.AreEqual(
                    1,
                    aggregateException.InnerExceptions.Count,
                    "Incorrect number of inner exceptions in Soft Assert");
            }
        }
Esempio n. 12
0
        public void PutEnvelope_CorrectAccountIdEnvelopeIdAndEnvelope_ReturnEnvelopeUpdateSummary()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            var envelope = new Envelope()
            {
                EnvelopeId   = _testConfig.EnvelopeId,
                EmailSubject = "new email subject",
                EmailBlurb   = "new email message",
                Status       = "sent"
            };

            EnvelopeUpdateSummary envelopeUpdateSummary = _envelopesApi.Update(_testConfig.AccountId, _testConfig.EnvelopeId, envelope);

            Assert.IsNotNull(envelopeUpdateSummary?.EnvelopeId);

            Envelope renewedEnvelope = _envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.AreEqual(envelope.EmailSubject, renewedEnvelope.EmailSubject);
            Assert.AreEqual(envelope.EmailBlurb, renewedEnvelope.EmailBlurb);
            Assert.AreEqual(envelope.Status, renewedEnvelope.Status);
        }
Esempio n. 13
0
        public void BadRequestIfRequestNull()
        {
            // Target Create
            var builder = new TestDiProviderBuilder();

            builder.ServiceCollection.AddTransient <DeliveryFilesController>();
            var controller = builder.Build().GetService <DeliveryFilesController>();

            // BadRequestが返るかチェック
            var createResponse = controller.PostDeliveryFile(null, UnitTestHelper.CreateLogger());

            Assert.IsInstanceOfType(createResponse, typeof(BadRequestObjectResult));

            var updateResponse = controller.PutDeliveryFile(null, 0, UnitTestHelper.CreateLogger());

            Assert.IsInstanceOfType(updateResponse, typeof(BadRequestObjectResult));

            var updateStatusResponse = controller.PutDeliveryFileStatus(null, 0, UnitTestHelper.CreateLogger());

            Assert.IsInstanceOfType(updateStatusResponse, typeof(BadRequestObjectResult));

            // DeleteはBadRequestを返さない
        }
Esempio n. 14
0
        public void GetRoomNeighboursFindsBasicPairReversed()
        {
            //A really wide room
            var wide = _plan.Add(
                new Vector2[] { new Vector2(-100, -10), new Vector2(-100, 10), new Vector2(100, 10), new Vector2(100, -10) },
                1f
                ).Single();

            //High room
            var high = _plan.Add(
                new Vector2[] { new Vector2(-10, 100), new Vector2(10, 100), new Vector2(10, 10), new Vector2(-10, 10) },
                1f
                ).Single();

            _plan.Freeze();
            DrawPlan();

            Assert.AreEqual(1, wide.Neighbours.Count());
            Assert.IsTrue(wide.Neighbours.Any(a => a.RoomCD == high));

            Assert.AreEqual(1, high.Neighbours.Count());
            Assert.IsTrue(high.Neighbours.Any(a => a.RoomCD == wide));
        }
Esempio n. 15
0
        public void Test_Basic()
        {
            var ce        = new CalculationEngine();
            var context   = new ExpressionContext();
            var variables = context.Variables;

            variables.Add("x", 100);
            ce.Add("a", "x * 2", context);
            variables.Add("y", 1);
            ce.Add("b", "a + y", context);
            ce.Add("c", "b * 2", context);
            ce.Recalculate("a");

            var result = ce.GetResult <int>("c");

            Assert.AreEqual(result, ((100 * 2) + 1) * 2);
            variables.Remove("x");
            variables.Add("x", 345);
            ce.Recalculate("a");
            result = ce.GetResult <int>("c");

            Assert.AreEqual(((345 * 2) + 1) * 2, result);
        }
        public void JwtCreateEmbeddedSigningViewTest()
        {
            JwtRequestSignatureOnDocumentTest();

            // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
            EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration);

            RecipientViewRequest viewOptions = new RecipientViewRequest()
            {
                ReturnUrl            = testConfig.ReturnUrl,
                ClientUserId         = "1234", // must match clientUserId set in step #2!
                AuthenticationMethod = "email",
                UserName             = testConfig.RecipientName,
                Email = testConfig.RecipientEmail
            };

            // create the recipient view (aka signing URL)
            ViewUrl recipientView = envelopesApi.CreateRecipientView(testConfig.AccountId, testConfig.EnvelopeId, viewOptions);

            Assert.IsNotNull(recipientView);

            Assert.IsNotNull(recipientView.Url);
        }
Esempio n. 17
0
        public void TestLaunchWithErrorsRun()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\ErrorProject.sln");

                GetOptions().PromptBeforeRunningWithBuildErrorSetting = true;

                var debug3 = (Debugger3)app.Dte.Debugger;
                ThreadPool.QueueUserWorkItem(x => debug3.Go(true));

                var dialog = new PythonLaunchWithErrorsDialog(app.WaitForDialog());
                dialog.No();

                // make sure we don't go into debug mode
                for (int i = 0; i < 10; i++)
                {
                    Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode);
                    System.Threading.Thread.Sleep(100);
                }

                WaitForMode(app, dbgDebugMode.dbgDesignMode);
            }
        }
Esempio n. 18
0
        public void ExcpirationTimeTestValidation()
        {
            //Arrange
            var entityManager = new EntitiesManager <Category>(new MemoryCache <IEnumerable <Category> >(cachePolicyService));

            FieldInfo  cacheField      = entityManager.GetType().GetField("cache", BindingFlags.NonPublic | BindingFlags.Instance);
            object     cacheFieldValue = cacheField.GetValue(entityManager);
            MethodInfo method          = cacheFieldValue.GetType().GetMethod("Get", new Type[] { typeof(string) });
            double     interval        = Convert.ToDouble(ConfigurationManager.AppSettings["TimeIntervalMilliseconds"]) - 200;

            //Act
            var entities = entityManager.GetEntities();

            Thread.Sleep(Convert.ToInt32(interval));

            IEnumerable <Category> cacheValue = (IEnumerable <Category>)method.Invoke(cacheFieldValue,
                                                                                      new object[] { Thread.CurrentPrincipal.Identity.Name + " " + typeof(Category) });

            //Assert
            Assert.IsTrue(entities != null);
            Assert.IsTrue(cacheValue != null);
            Assert.IsTrue(cacheValue.Any());
        }
Esempio n. 19
0
        public void ShouldAddBooking()
        {
            // arrange
            RoomBookingInfo RequestAddBooking = new RoomBookingInfo
            {
                Id                   = 2,
                PersonName           = "DummyName",
                PersonDOB            = Convert.ToString(DateTime.Now.AddYears(-20)),
                RoomName             = "DummyRoom1",
                BookingDateTimeStart = DateTime.Now,

                lengthBookingMin   = 50,
                BookingDateTimeEnd = DateTime.Now.AddMinutes(50),
                BookingNote        = "test"
            };

            //act

            var result = controller.CreateRoomBooking(RequestAddBooking);

            // assert
            Assert.IsNotNull(result);
        }
Esempio n. 20
0
        public void MllpClient_Receives_Server_Certificate_And_Certificate_Rejection_Is_Respected()
        {
            // arrange
            using (MllpServer server = this.StartupMllpServer(useSsl: true))
            {
                var securityDetails   = new ClientSecurityDetails((sender, certificate, chain, sslPolicyErrors) => false); // reject server certificate.
                var connectionDetails = new ClientConnectionDetails(server.EndPoint.Address.ToString(), server.EndPoint.Port, Encoding.ASCII, null, securityDetails);

                try
                {
                    // act
                    using (MllpClient testee = (MllpClient)MllpClient.Create(connectionDetails).Result)
                    {
                        // assert
                        Assert.Fail("method should result in error since certificate was rejected.");
                    }
                }
                catch (AggregateException aggregateException)
                {
                    Assert.AreEqual(typeof(AuthenticationException), aggregateException.InnerException.GetType());
                }
            }
        }
Esempio n. 21
0
        public void JwtListEnvelopesTest()
        {
            // This example gets statuses of all envelopes in your account going back 1 full month...
            DateTime fromDate = DateTime.UtcNow;

            fromDate = fromDate.AddDays(-30);
            string fromDateStr = fromDate.ToString("o");

            // set a filter for the envelopes we want returned using the fromDate and count properties
            EnvelopesApi.ListStatusChangesOptions options = new EnvelopesApi.ListStatusChangesOptions()
            {
                count    = "10",
                fromDate = fromDateStr
            };

            // |EnvelopesApi| contains methods related to envelopes and envelope recipients
            EnvelopesApi         envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration);
            EnvelopesInformation envelopes    = envelopesApi.ListStatusChanges(testConfig.AccountId, options);

            Assert.IsNotNull(envelopes);
            Assert.IsNotNull(envelopes.Envelopes);
            Assert.IsNotNull(envelopes.Envelopes[0].EnvelopeId);
        } // end listEnvelopesTest()
Esempio n. 22
0
        public void ProcessBill_WhenNoPromotionRule_Then_CalculateTotalPrice()
        {
            //Arrange
            var carts = new List <Cart>()
            {
                new Cart(Constants.A, 2)
            };

            var item = new Item()
            {
                SkuId = Constants.A, Name = "A Name", Price = 50
            };

            _promotionRuleServicesMock.Setup(x => x.GetPromotionRulesBySkuId(Constants.A))
            .Returns <PromotionRule>(null);
            _itemServicesMock.Setup(x => x.GetItemBySkuId(Constants.A)).Returns(item);

            //Act
            var totalPrice = _orderServices.ProcessBill(carts);

            //Assert
            Assert.AreEqual(totalPrice, 100);
        }
Esempio n. 23
0
        public void GetStringValueTest(string targetPropertyName, string actualValue, string expected)
        {
            // テスト対象の準備
            //NULLか空欄ではなかったら
            var diBuilder = new TestDiProviderBuilder();

            if (!string.IsNullOrEmpty(actualValue))
            {
                ///keyと値の追加
                diBuilder.AddConfigure(targetPropertyName, actualValue);
            }
            var         provider   = diBuilder.Build();
            AppSettings testTarget = provider.GetService(typeof(AppSettings)) as AppSettings;

            // テスト
            //プロパティを取ってくる
            //actual 取ってきた値
            var    property = typeof(AppSettings).GetProperty(targetPropertyName);
            string actual   = property.GetValue(testTarget) as string;

            //結果
            Assert.AreEqual(expected, actual);
        }
Esempio n. 24
0
        public void Create_WithNonExistingItem_DoesNotThrow()
        {
            Guid GroupId = new Guid();

            var model = new GroupDetailModelDTO
            {
                Posts = new List <PostDetailModelDTO>()
                {
                    new PostDetailModelDTO()
                    {
                        Id = GroupId
                    }
                },
                Description = "test description",
                Name        = "test name"
            };

            var returnedModel = fixture.Repository.AddGroup(model);

            Assert.IsNotNull(returnedModel);

            fixture.Repository.RemoveGroup(returnedModel.Id);
        }
Esempio n. 25
0
 public void Value_CheckIfValue_ExpectedException()
 {
     this.RunInAllBrowsers(browser =>
     {
         browser.NavigateToUrl("/test/value");
         MSAssert.ThrowsException <UnexpectedElementStateException>(() =>
         {
             browser.First("#input-radio2").CheckIfValue("radio1");
         });
         MSAssert.ThrowsException <UnexpectedElementStateException>(() =>
         {
             browser.First("#area").CheckIfValue("wrongvalue");
         });
         MSAssert.ThrowsException <UnexpectedElementStateException>(() =>
         {
             browser.First("#input-text").CheckIfValue("texT1");
         });
         MSAssert.ThrowsException <UnexpectedElementStateException>(() =>
         {
             browser.First("#input-text").CheckIfValue("   text1   ", trimValue: false);
         });
     });
 }
Esempio n. 26
0
        public void AuditUsingSpecificTypeAuditorActionWithParm()
        {
            MyDefaultAuditor.SetActionCallbacksExpected();
            ITestObject foo = GetTestService("Foos").GetAction("New Instance").InvokeReturnObject();

            MyDefaultAuditor.SetActionCallbacksUnexpected();

            int fooCalledCount = 0;

            FooAuditor.Auditor.actionInvokedCallback = (p, a, o, b, pp) => {
                Assert.AreEqual("sven", p.Identity.Name);
                Assert.AreEqual("AnActionWithParm", a);
                Assert.IsNotNull(o);
                Assert.AreEqual("NakedObjects.SystemTest.Audit.Foo", o.GetType().FullName);
                Assert.IsFalse(b);
                Assert.AreEqual(1, pp.Count());
                Assert.AreEqual(1, pp[0]);
                fooCalledCount++;
            };

            foo.GetAction("An Action With Parm").InvokeReturnObject(1);
            Assert.AreEqual(1, fooCalledCount, "expect foo auditor to be called");
        }
        public void JwtLoginTest()
        {
            testConfig.ApiClient = new ApiClient(testConfig.Host);

            Assert.IsNotNull(testConfig.PrivateKey);

            byte[] privateKeyStream = Convert.FromBase64String(testConfig.PrivateKey);

            var scopes = new List <string>();

            scopes.Add("dtr.company.write");
            scopes.Add("dtr.company.read");
            scopes.Add("dtr.rooms.write");
            scopes.Add("dtr.rooms.read");
            scopes.Add("signature");
            scopes.Add("impersonation");

            OAuth.OAuthToken tokenInfo = testConfig.ApiClient.RequestJWTUserToken(testConfig.IntegratorKey, testConfig.UserId, testConfig.OAuthBasePath, privateKeyStream, testConfig.ExpiresInHours, scopes);

            // the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object
            OAuth.UserInfo userInfo = testConfig.ApiClient.GetUserInfo(tokenInfo.access_token);

            Assert.IsNotNull(userInfo);
            Assert.IsNotNull(userInfo.Accounts);

            foreach (var item in userInfo.Accounts)
            {
                if (item.IsDefault == "true")
                {
                    testConfig.AccountId = item.AccountId;
                    //testConfig.ApiClient.SetBasePath(item.BaseUri + "/restapi");
                    break;
                }
            }

            Assert.IsNotNull(testConfig.AccountId);
        }
Esempio n. 28
0
        public void RegressionTest_NaN_WallSections()
        {
            // This is a case generated from fuzz testing (i.e. generate random data, see what breaks).
            // This room is shaped like:
            //
            // +---------+
            // |         |
            // X---X     |
            //     |     |
            //     +-----+
            //
            // Shrinking this room results in a corner like this (at the X--X edge):
            //
            // |    +-----+
            // |          |
            // X----X     |
            //
            // The inside point is aligned with the outside point, logically this wall section is just two corners with no facade in the center.
            // Before fixing this case, some NaN sections were generated because of this case, now they aren't, and this test makes sure we don't undo that change.

            var v = new[] { new Vector2(15, 14), new Vector2(2, 14), new Vector2(2, 22), new Vector2(1, 22), new Vector2(1, 25), new Vector2(15, 25) };

            var r = _plan.Add(v, 1);

            _plan.Freeze();

            var f = r.Single().GetWalls();

            foreach (var facade in f)
            {
                Assert.IsFalse(facade.Section.Inner1.IsNaN());
                Assert.IsFalse(facade.Section.Inner2.IsNaN());
                Assert.IsFalse(facade.Section.Outer1.IsNaN());
                Assert.IsFalse(facade.Section.Outer2.IsNaN());
                Assert.IsFalse(facade.Section.Along.IsNaN());
            }
        }
Esempio n. 29
0
        public void OperatorPlus_OneEmptyLists_ContainsNonEmptyList()
        {
            // Arrange
            int         itemsToAdd = 10;
            JList <int> j          = new JList <int>();
            JList <int> k          = new JList <int>();
            JList <int> l          = new JList <int>();

            for (int i = 0; i < itemsToAdd; i++)
            {
                j.Add(i);
            }

            // Act
            l = j + k;

            // Assert
            bool validNewList = true;

            for (int i = 0; i < l.Count; i++)
            {
                if (i < j.Count)
                {
                    if (j[i] != l[i])
                    {
                        validNewList = false;
                        break;
                    }
                }
                else
                {
                    validNewList = false;
                    break;
                }
            }
            Assert.IsTrue(validNewList);
        }
Esempio n. 30
0
        public void StartWithDebuggingSubfolderInProject()
        {
            string scriptFilePath = TestData.GetPath(@"TestData\DebuggerProject\Sub\paths.py");

            using (var app = new VisualStudioApp()) {
                OpenDebuggerProject(app);

                app.Dte.ItemOperations.OpenFile(scriptFilePath);
                app.Dte.Debugger.Breakpoints.Add(File: scriptFilePath, Line: 3);
                app.Dte.ExecuteCommand("Project.StartWithDebugging");
                WaitForMode(app, dbgDebugMode.dbgBreakMode);
                Assert.AreEqual(dbgDebugMode.dbgBreakMode, app.Dte.Debugger.CurrentMode);
                AssertUtil.ContainsAtLeast(
                    app.Dte.Debugger.GetExpression("sys.path").DataMembers.Cast <Expression>().Select(e => e.Value),
                    "'" + TestData.GetPath(@"TestData\DebuggerProject").Replace("\\", "\\\\") + "'"
                    );
                Assert.AreEqual(
                    "'" + TestData.GetPath(@"TestData\DebuggerProject\Sub").Replace("\\", "\\\\") + "'",
                    app.Dte.Debugger.GetExpression("os.path.abspath(os.curdir)").Value
                    );
                app.Dte.Debugger.Go(WaitForBreakOrEnd: true);
                Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode);
            }
        }