Exemple #1
0
        public IEnumerator TestImportlessAlembic()
        {
            director.Play();
            exporter.MaxCaptureFrame = 30;
            yield return(RecordAlembic());

            deleteFileList.Add(exporter.Recorder.Settings.OutputPath);

            var sceneName = GUID.Generate().ToString();
            var scene     = SceneManager.CreateScene(sceneName);

            SceneManager.SetActiveScene(scene);
            var go     = new GameObject("abc");
            var player = go.AddComponent <AlembicStreamPlayer>();
            var ret    = player.LoadFromFile(exporter.Recorder.Settings.OutputPath);

            Assert.IsTrue(ret);

            var cubeGO = go.GetComponentInChildren <MeshRenderer>().gameObject;

            player.UpdateImmediately(0);
            var t0 = cubeGO.transform.position;

            player.UpdateImmediately(player.Duration);
            var t1 = cubeGO.transform.position;

            Assert.AreNotEqual(t0, t1);

            var asyncOperation = SceneManager.UnloadSceneAsync(sceneName);

            while (!asyncOperation.isDone)
            {
                yield return(null);
            }
        }
Exemple #2
0
        public void NewItem_C()
        {
            var item = provider.NewItem(provider.Root, typeManager.GetTypeItem(DeviceType.Sensor));

            item.Name        = "";
            item.Order       = int.MaxValue;
            item.ValueDate   = DateTime.MaxValue;
            item.ValueNumber = double.MaxValue;
            item.ValueString = "";
            item.SubTypes.Set(SensorType.Brightness);
            item.SubTypes.Set(SensorType.SetTemperature);

            Assert.AreNotEqual(Guid.Empty, item.Guid);
            Assert.AreEqual(item.Type, typeManager.GetTypeItem(DeviceType.Sensor));
            Assert.AreEqual(item.Children.Count, 0);
            Assert.AreEqual(item.Related.Count, 0);
            Assert.AreEqual(item.Created, DateTime.MinValue);
            Assert.AreEqual(item.Modified, DateTime.MinValue);
            Assert.IsFalse(item.IsParentResolved);
            Assert.AreEqual(item.Debug, false);
            Assert.AreEqual(item.Name, "DeviceType");
            Assert.AreEqual(item.Order, int.MaxValue);
            Assert.AreEqual(item.Parent, provider.Root);
            Assert.AreEqual(item.Revision, 0);
            Assert.AreEqual(item.ValueString, null);
            Assert.AreEqual(item.ValueNumber, double.MaxValue);
            Assert.AreEqual(item.ValueDate, DateTime.MaxValue);
            Assert.IsFalse(item.SubTypes.IsEmpty);
            Assert.IsTrue(item.SubTypes.Contains(SensorType.Brightness));
            Assert.IsTrue(item.SubTypes.Contains(SensorType.SetTemperature));
            Assert.IsFalse(item.SubTypes.Contains(SensorType.Temperature));
        }
Exemple #3
0
        public void SaveAndGetItem()
        {
            var item = provider.NewItem(provider.Root, typeManager.GetTypeItem(DeviceType.Meter));

            item.Name        = "Example";
            item.Order       = -1;
            item.ValueDate   = DateTime.MinValue.AddMilliseconds(1);
            item.ValueNumber = 1.1;
            item.ValueString = "string";

            var id = provider.Save(item);

            var actual = provider.GetItemByReference(item);

            Assert.AreNotEqual(Guid.Empty, actual.Guid);
            Assert.AreEqual(id, actual.Guid);
            Assert.AreEqual(actual.Type, typeManager.GetTypeItem(DeviceType.Meter));
            Assert.AreEqual(actual.Children.Count, 0);
            Assert.AreEqual(actual.Related.Count, 0);
            Assert.AreEqual(actual.Created, item.Created);
            Assert.AreEqual(actual.Modified, item.Modified);
            Assert.IsFalse(actual.IsParentResolved);
            Assert.AreEqual(actual.Debug, false);
            Assert.AreEqual(actual.Name, "Example");
            Assert.AreEqual(actual.Order, -1);
            Assert.AreEqual(actual.Parent, provider.Root);
            Assert.AreEqual(actual.Revision, 0);
            Assert.AreEqual(actual.ValueString, "string");
            Assert.AreEqual(actual.ValueNumber, 1.1);
            Assert.AreEqual(actual.ValueDate, DateTime.MinValue.AddMilliseconds(1));
            Assert.IsTrue(actual.SubTypes.IsEmpty);
        }
Exemple #4
0
        public void CreateFileForCompilationTest()
        {
            string       extension = null;
            const string Source    = "My source code";
            string       currentFilePath;

            try
            {
                currentFilePath = Helper.CreateFileForCompilation(Source, extension);
                Assert.AreEqual(true, false);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            try
            {
                extension       = "cpp";
                currentFilePath = Helper.CreateFileForCompilation(Source, extension);
                Assert.AreNotEqual(true, string.IsNullOrEmpty(currentFilePath));
                Assert.AreEqual(File.Exists(currentFilePath), true);

                var text = File.ReadAllText(currentFilePath);
                Assert.AreNotEqual(true, string.IsNullOrEmpty(text));
                Assert.AreEqual(text, Source);
            }
            catch (Exception)
            {
                Assert.AreEqual(false, true);
            }
        }
Exemple #5
0
        public virtual void AssertNotEqual(string expected, bool ignoreRegister = false)
        {
            var text = ignoreRegister ? Text?.ToLower() : Text;

            expected = ignoreRegister ? expected?.ToLower() : expected;
            Assert.AreNotEqual(expected, text?.Replace("'", ""), $"Component text '{ComponentName}' are not equal to expected value");
        }
Exemple #6
0
        public void ParseTest()
        {
            var correctXmlFilePath   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Compilers\CPP8\CPP8.xml");
            var incorrectXmlFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Compilers\CsSharp\CSharp.xml");

            var compilers     = new Compilers("Compilers");
            var privateObject = new PrivateObject(compilers, new PrivateType(typeof(Compilers)));

            // incorrect xml file
            try
            {
                privateObject.Invoke("Parse", incorrectXmlFilePath);
                Assert.AreEqual(true, false);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, true);
            }

            // correct xml file
            try
            {
                Assert.AreNotEqual(null, privateObject.Invoke("Parse", correctXmlFilePath));
            }
            catch (Exception)
            {
                Assert.AreEqual(true, false);
            }
        }
        public void TestCollectionUpdate()
        {
            var so1 = new SimpleObject {
                ValueOne = 1, ValueTwo = 2
            };
            var so2 = new SimpleObject {
                ValueOne = 3, ValueTwo = 4
            };
            var co = new CollectionObject();

            co.CollectionOne.Add(so1);

            var clone = (CollectionObject)CopyUtils.CloneObjectTest(co);

            clone.CollectionOne.Add(so2);

            Assert.AreNotSame(co, clone);
            Assert.AreSame(co.GetType(), clone.GetType());
            Assert.AreNotSame(co.CollectionOne, clone.CollectionOne);
            Assert.AreNotEqual(co.CollectionOne.Count(), clone.CollectionOne.Count());

            CopyUtils.UpdateFromClone(co, clone);

            Assert.AreNotSame(co, clone);
            Assert.AreSame(co.GetType(), clone.GetType());
            Assert.AreNotSame(co.CollectionOne, clone.CollectionOne);
            Assert.AreEqual(co.CollectionOne.Count(), clone.CollectionOne.Count());
            Assert.AreSame(co.CollectionOne.First(), clone.CollectionOne.First());
            Assert.AreSame(co.CollectionOne.ElementAt(1), clone.CollectionOne.ElementAt(1));
        }
        public void TC017_DeleteHolidayRequestInPendingStatus()
        {
            IWebDriver driver = new ChromeDriver();

            driver.Manage().Window.Maximize();
            driver.Url = "https://*****:*****@bt.com");

            IWebElement password = driver.FindElement(By.Name("Input.Password"));

            password.Click();
            password.SendKeys("AnaMaria1234?");

            driver.FindElement(By.ClassName("btn-primary")).Click();

            List <IWebElement> tableRows = driver.FindElement(By.Id("holidaysTablebody")).FindElements(By.TagName("tr")).ToList();

            driver.FindElement(By.ClassName("fa-trash-alt")).Click();

            Assert.AreEqual("Delete Holiday - Holidays App", driver.Title);

            driver.FindElement(By.ClassName("btn-danger")).Click();

            var newTableNumber = driver.FindElement(By.Id("holidaysTablebody")).FindElements(By.TagName("tr")).ToList();

            Assert.AreNotEqual(tableRows, newTableNumber);

            driver.Quit();
        }
        public IEnumerator ItUpdatesSessionExpirationWithEveryRequest()
        {
            yield return(OnFacet <SessionFacet> .Call(
                             nameof(SessionFacet.Set),
                             "foo",
                             Vector3.up
                             ).AsCoroutine());

            string oldSessionExpiration = null;

            yield return(OnFacet <SessionFacet> .Call <JsonObject>(
                             nameof(SessionFacet.GetSessionRecord)
                             ).Then(r => {
                oldSessionExpiration = r["expiresAt"].AsString;
            }).AsCoroutine());

            yield return(OnFacet <SessionFacet> .Call(
                             nameof(SessionFacet.EmptyFacetMethod)
                             ).AsCoroutine());

            yield return(OnFacet <SessionFacet> .Call <JsonObject>(
                             nameof(SessionFacet.GetSessionRecord)
                             ).Then(r => {
                Assert.AreNotEqual(
                    oldSessionExpiration,
                    r["expiresAt"].AsString
                    );
            }).AsCoroutine());
        }
        public async void GetWeatherObservationByDate_Date201911202_Return0CorrectObservations()
        {
            UnitTests u     = new UnitTests();
            int       count = 0;

            foreach (var w in _listOfWeatherObservations)
            {
                if (count < 1)
                {
                    w.Date = new DateTime(2019, 12, 02, 08, 30, 00);
                    await _uut.PostWeatherObservation(w);
                }
                else
                {
                    w.Date = new DateTime(2019, 12, 05, 10, 30, 00);
                    await _uut.PostWeatherObservation(w);
                }
                count++;
            }

            ActionResult <List <WeatherObservation> > weatherData = new List <WeatherObservation>();

            DateTime getDate = new DateTime(2020, 12, 02, 08, 30, 00);

            weatherData = await _uut.GetWeatherByDate(getDate);

            Assert.AreNotEqual(1, weatherData.Value.Count);
        }
Exemple #11
0
        public void ParameterDict()
        {
            var a    = new torch.nn.Parameter(new[] { 0.5 });
            var b    = new torch.nn.Parameter(new[] { 0.3 });
            var dict = new torch.nn.ParameterDict(
                ("a", a),
                ("b", b)
                );

            Assert.AreEqual(a.repr, dict["a"].repr);
            Assert.AreNotEqual(a.repr, dict["b"].repr);
            Assert.AreEqual(b.repr, dict["b"].repr);
            Assert.Throws <PythonException>(() =>
            {
                var x = dict["nothing"];
            });
            var items = dict.items().ToArray();

            Assert.AreEqual(2, items.Length);
            Assert.AreEqual("a", items[0].Item1);
            Assert.AreEqual("b", items[1].Item1);
            Assert.AreEqual("Parameter containing:\ntensor([0.5000], dtype=torch.float64, requires_grad=True)", items[0].Item2.repr);
            Assert.AreEqual("Parameter containing:\ntensor([0.3000], dtype=torch.float64, requires_grad=True)", items[1].Item2.repr);
            Assert.AreEqual("a, b", string.Join(", ", dict.keys()));
            Assert.AreEqual("Parameter containing:\ntensor([0.5000], dtype=torch.float64, requires_grad=True)|Parameter containing:\ntensor([0.3000], dtype=torch.float64, requires_grad=True)", string.Join("|", dict.values().Select(v => v.repr)));
            Assert.AreEqual("a, b", string.Join(", ", dict.Select(x => x.Item1)));
            Assert.AreEqual("Parameter containing:\ntensor([0.5000], dtype=torch.float64, requires_grad=True)|Parameter containing:\ntensor([0.3000], dtype=torch.float64, requires_grad=True)", string.Join("|", dict.Select(x => x.Item2.repr)));
            Assert.AreEqual("Parameter containing:\ntensor([0.5000], dtype=torch.float64, requires_grad=True)", dict.pop("a").repr);
            Assert.AreEqual(1, dict.items().Count());
            dict.clear();
            Assert.AreEqual(0, dict.items().Count());
            dict.update(("a", a), ("b", b));
            Assert.AreEqual(2, dict.items().Count());
            Assert.AreEqual(2, dict.len());
        }
Exemple #12
0
        public void ModuleList()
        {
            var a    = new torch.nn.Conv1d(2, 2, 5);
            var b    = new torch.nn.Conv1d(1, 1, 3);
            var list = new torch.nn.ModuleList(a, b);

            Assert.AreEqual(a.repr, list[0].repr);
            Assert.AreNotEqual(a.repr, list[1].repr);
            Assert.AreEqual(b.repr, list[1].repr);
            Assert.Throws <PythonException>(() =>
            {
                var x = list[2];
            });
            Assert.AreEqual(2, list.Count());
            Assert.AreEqual("Conv1d(2, 2, kernel_size=(5,), stride=(1,))", list[0].repr);
            Assert.AreEqual("Conv1d(1, 1, kernel_size=(3,), stride=(1,))", list[1].repr);
            Assert.AreEqual("Conv1d(2, 2, kernel_size=(5,), stride=(1,))|Conv1d(1, 1, kernel_size=(3,), stride=(1,))", string.Join("|", list.Select(v => v.repr)));
            list.extend(b);
            Assert.AreEqual(3, list.Count());
            list.append(a);
            Assert.AreEqual(4, list.Count());
            list.insert(2, a);
            Assert.AreEqual(new[] { a, b, a, b, a }.Select(x => x.repr).ToArray(), list.Select(x => x.repr).ToArray());
            Assert.AreEqual(5, list.len());
        }
Exemple #13
0
        public void NewItem_B()
        {
            var item = provider.NewItem(provider.Root, typeManager.GetTypeItem(DeviceType.Meter));

            item.Name        = "Example item";
            item.Order       = int.MinValue;
            item.ValueDate   = DateTime.MinValue.AddMilliseconds(1);
            item.ValueNumber = double.MinValue * 1.1;
            item.ValueString = new string('E', 1024 * 1024);

            Assert.AreNotEqual(Guid.Empty, item.Guid);
            Assert.AreEqual(item.Type, typeManager.GetTypeItem(DeviceType.Meter));
            Assert.AreEqual(item.Children.Count, 0);
            Assert.AreEqual(item.Related.Count, 0);
            Assert.AreEqual(item.Created, DateTime.MinValue);
            Assert.AreEqual(item.Modified, DateTime.MinValue);
            Assert.IsFalse(item.IsParentResolved);
            Assert.AreEqual(item.Debug, false);
            Assert.AreEqual(item.Name, "Example item");
            Assert.AreEqual(item.Order, int.MinValue);
            Assert.AreEqual(item.Parent, provider.Root);
            Assert.AreEqual(item.Revision, 0);
            Assert.AreEqual(item.ValueString.Length, 1024 * 1024);
            Assert.AreEqual(item.ValueString, new string('E', 1024 * 1024));
            Assert.AreEqual(item.ValueNumber, double.MinValue * 1.1);
            Assert.AreEqual(item.ValueDate, DateTime.MinValue.AddMilliseconds(1));
            Assert.IsTrue(item.SubTypes.IsEmpty);
        }
Exemple #14
0
        public void SaveNewAndGet()
        {
            var item = provider.NewItem(provider.Root, typeManager.GetTypeItem(DeviceType.Meter));

            item.Order       = Int32.MaxValue;
            item.ValueDate   = new DateTime(2100, 1, 1);
            item.ValueNumber = Math.PI;
            item.ValueString = new string('C', 1024 * 1024);

            var id = provider.SaveNew(item);

            var actual = provider.GetItemByReference(item);

            Assert.AreNotEqual(Guid.Empty, actual.Guid);
            Assert.AreEqual(id, actual.Guid);
            Assert.AreEqual(actual.Type, typeManager.GetTypeItem(DeviceType.Meter));
            Assert.AreEqual(actual.Children.Count, 0);
            Assert.AreEqual(actual.Related.Count, 0);
            Assert.AreEqual(actual.Created, item.Created);
            Assert.AreEqual(actual.Modified, item.Modified);
            Assert.IsFalse(actual.IsParentResolved);
            Assert.AreEqual(actual.Debug, false);
            Assert.AreEqual(actual.Name, "DeviceType");
            Assert.AreEqual(actual.Order, Int32.MaxValue);
            Assert.AreEqual(actual.Parent, provider.Root);
            Assert.AreEqual(actual.Revision, 0);
            Assert.AreEqual(actual.ValueString, item.ValueString);
            Assert.AreEqual(actual.ValueNumber, Math.PI);
            Assert.AreEqual(actual.ValueDate, item.ValueDate);
            Assert.IsTrue(actual.SubTypes.IsEmpty);
        }
Exemple #15
0
        public void XmlEncodingDeclaration()
        {
            var creator = new Mocks.MockWebRequestCreator();

            creator.CharacterSet = null;

            var html = ReplaceCharacterSet(TestHtml("arabic"), "ISO-8859-1");

            creator.ResponseStream = GetMemoryStream(html, null);
            CsqWebRequest request = new CsqWebRequest("http://test.com", creator);

            var dom = ProcessMockWebRequestSync(request);

            Assert.AreNotEqual(arabicExpected, dom["h1"].Text());


            // contains xml UTF8 and inline ISO encoding

            html = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + html;
            creator.ResponseStream = GetMemoryStream(html, null);
            request = new CsqWebRequest("http://test.com", creator);

            dom = ProcessMockWebRequestSync(request);
            Assert.AreEqual(arabicExpected, dom["h1"].Text());
        }
Exemple #16
0
 public void TestUserChannel()
 {
     _creator = new User()
     {
         ID          = new Guid("aa918dde-94e0-4323-a281-c8274d67eaca"),
         UserChannel = "useraa918dde-94e0-4323-a281-c8274d67eaca",
         Name        = "Catherine C"
     };
     invitee = new User()
     {
         Name = "Benjamin D",
         //AuthenticatedChannels = new List<string>(),
         ID = new Guid("b40354dc-5734-432e-b6c5-24adf8890312")
     };
     user3 = new User()
     {
         ID = new Guid("bc7b0d2f-6e80-430e-b096-6cb8fa06c2b2"),
         //AuthenticatedChannels = new List<string>(),
         Name = "User 3"
     };
     Assert.NotNull(_creator.UserChannel);
     Assert.NotNull(invitee.UserChannel);
     Assert.AreEqual(invitee.UserChannel, "user" + invitee.ID);
     user3.UserChannel = "bogus channel";
     Assert.NotNull(user3.UserChannel);
     Assert.AreNotEqual(user3.UserChannel, "user" + user3.ID);
 }
Exemple #17
0
        public void TestUrlEquals()
        {
            string url = "http://google.com";
            var    obj = new HttPingScheduleItem();

            obj.Execute(url);
            Assert.AreNotEqual(obj.Execute(url).Url, url);
        }
Exemple #18
0
        public void TestPingNegateFalse()
        {
            string url = "qweqweqwe";
            var    obj = new HttPingScheduleItem();

            obj.Execute(url);
            Assert.AreNotEqual(obj.Execute(url).Latency > 0, true);
        }
Exemple #19
0
        public void GetHashCodeAndEqualsAreConsistentForNonMatchingTypes()
        {
            Type[] types      = new[] { typeof(ParentClass), typeof(IEnumerable) };
            Type[] otherTypes = new[] { typeof(ParentClass), typeof(ICollection) };

            Assert.AreNotEqual(new CompositeType(types).GetHashCode(), new CompositeType(otherTypes).GetHashCode(), "Hash codes are the same");
            Assert.AreNotEqual(new CompositeType(types), new CompositeType(otherTypes), "Expected to not be equal");
        }
        public void pending_test__for_User()
        {
            Room rt = new Room(1, 11, RoomType.AC_DOUBLE, BookingStatus.RESERVED, new DateTime(2020 - 12 - 12), new DateTime(2020 - 12 - 15), 5);
            //RoomFactory rf = new RoomFactory();
            BookingStatus st = RoomBookingSystem.RoomFactory.Pending(rt);

            Assert.AreNotEqual(BookingStatus.PENDING, st);
        }
Exemple #21
0
        public void TestHeadersAccessFalse()
        {
            string url = "qweqweqwe";
            var    obj = new HttPingScheduleItem();

            obj.Execute(url);
            Assert.AreNotEqual(obj.Execute(url).IsAccessible, true);
        }
Exemple #22
0
        public void Index_Retrieve_All_Data_Fail()
        {
            var actionResult    = _customerController.Index();
            var viewResult      = actionResult as ViewResult;
            var viewResultModel = (Customer[])viewResult.Model;
            var customerInfo    = viewResultModel.ToList();

            Assert.AreNotEqual(1, customerInfo.Count);
        }
        public void TripsWithTransfer()
        {
            steps.SelectMainPage();
            steps.InsertSelectionDataTransferWay(depatureName, destinationName, destinationName2);
            steps.StartSearchTickets();
            steps.SelectListPage();

            Assert.AreNotEqual(steps.ListCount(), 0);
        }
        public void BusinessTrip()
        {
            steps.SelectMainPage();
            steps.InsertBusinessSelectionData2Way(depatureName, destinationName);
            steps.StartSearchTickets();
            steps.SelectListPage();

            Assert.AreNotEqual(steps.ListCount(), 0);
        }
 public void DivisionTwoNumbers()
 {
     _firstNum       = 30;
     _secondNum      = 6;
     _expectedResult = 5;
     Assert.AreNotEqual(0, _secondNum, "Second number is not 0");
     _actualResult = Calc.Division(_firstNum, _secondNum);
     Assert.AreEqual(_expectedResult, _actualResult, $"Actual result of division {_firstNum} and {_secondNum} must be equal to {_expectedResult}");
 }
Exemple #26
0
        public virtual void Exception_id_propagates_from_log_entry_to_exception()
        {
            var ex    = new Exception();
            var entry = new LogEntry(ex);

            Log.Write(entry);
            Assert.AreNotEqual(Guid.Empty, entry.ExceptionId);
            Assert.AreEqual(entry.ExceptionId, (Guid)ex.Data["__Its_Log_ExceptionID__"]);
        }
Exemple #27
0
        public void TestGetAllClient()
        {
            clientsManagment.Load();
            Client client = new Client("av0", "bp", 228);

            clientsManagment.Insert(client);
            clientsManagment.SaveChanges();
            work.clientsManagment.Load();
            Assert.AreNotEqual("", work.GetClients());
        }
Exemple #28
0
        public void TestGetAllAdmin()
        {
            adminsManagment.Load();
            Admin client = new Admin("bp", "1245");

            adminsManagment.Insert(client);
            adminsManagment.SaveChanges();
            work.adminsManagment.Load();
            Assert.AreNotEqual("", work.GetAdmins());
        }
Exemple #29
0
        public void TestGetAllManager()
        {
            managersManagement.Load();
            Manager client = new Manager("125", "bp");

            managersManagement.Insert(client);
            managersManagement.SaveChanges();
            work.managersManagment.Load();
            Assert.AreNotEqual("", work.GetManagers());
        }
Exemple #30
0
        public void TestGetAllProduct()
        {
            productsManagment.Load();
            Product client = new Product("125", "124", "av0", "bp", 1245, 228);

            productsManagment.Insert(client);
            productsManagment.SaveChanges();
            work.productsManagment.Load();
            Assert.AreNotEqual("", work.GetProducts());
        }